0

I have this code:

$scope.search = function() {
            $scope.results = ejs.Request()
                .query(ejs.TermQuery("amount", 10)).size(10).from(0)
                .doSearch();
            console.log($scope.results.v);
        };

and :

<tr id="tr" ng-repeat="record in results.hits.hits" repeat-done="reload_scroll()">
                        <td><input type="checkbox" ng-model="record._source.checked"/></td>
                        <td>{{ record._source.id }}</td>

                    </tr>

and it work properly. But I want to have access to $scope.results in js code but when I write:

$scope.search = function() {
            $scope.results = ejs.Request()
                .query(ejs.TermQuery("amount", 10)).size(10).from(0)
                .doSearch();
            console.log($scope.results.$$v);

        };

but it print undefined it console, what should I use instead $$v? Thanks.

Aryan
  • 2,675
  • 5
  • 24
  • 33

1 Answers1

0

Since it is a async call you would get the results in a callback. Something like

ejs.Request()
 .query(ejs.TermQuery("amount", 10)).size(10).from(0)
 .doSearch().then(function(data) {
         console.log(data);
});
Chandermani
  • 42,589
  • 12
  • 85
  • 88