Reputation: 1007
I have a search controller that I am using:
function searchRes($scope, $http, API, CarDetailService, $state){
$scope.$watch('search', function() {
fetch();
});
$scope.currentPage = 1;
$scope.pageSize = 5;
function fetch(){
$http.get(API + "/search/" + $scope.search)
.then(function(response){
$scope.details = response.data;
});
}
$scope.select = function(){
this.setSelectionRange(0, this.value.length);
}
$scope.selectCar = function(carId) {
CarDetailService.setCar(carId);
$state.go('taskDetails');
};
}
Here is the HTML:
<div ng-controller="searchRes" class="mainSearch">
<div class="searchBar">
<input type="text" ng-model="search" onclick="select()" placeholder="Enter Search Term" autofocus />
</div>
<div ng-repeat="res in details.Search">
<div>{{ res['Display Name'] }}</div>
</div>
</div>
I have tried:
ng-repeat="res in details"
ng-repeat="res in response.data"
ng-repeat="res in data"
ng-repeat="res in response"
ng-repeat="res in response.data.Results"
ng-repeat="res in details.data.Results"
Here is an image of what the API returns (data.Results):
EDIT when I do a console.log(response); I can see all the JSON data being returned (data.Results)
I know I am obviously not calling the data properly but I don't know what else to try which i guess is why I am here.
Upvotes: 0
Views: 80