agon024 agon024 - 11 months ago 47
Javascript Question

Angular - ng-repeat not working with search controller

I have a search controller that I am using:

function searchRes($scope, $http, API, CarDetailService, $state){

$scope.$watch('search', function() {

$scope.currentPage = 1;
$scope.pageSize = 5;

function fetch(){
$http.get(API + "/search/" + $
$scope.details =;

$ = function(){
this.setSelectionRange(0, this.value.length);

$scope.selectCar = function(carId) {


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 ng-repeat="res in details.Search">
<div>{{ res['Display Name'] }}</div>


I have tried:

ng-repeat="res in details"
ng-repeat="res in"
ng-repeat="res in data"
ng-repeat="res in response"
ng-repeat="res in"
ng-repeat="res in"

Here is an image of what the API returns (data.Results):

enter image description here

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.


You need ng-repeat="res in details.Results".