2016-08-16 4 views
0

検索コントローラで動作していない:私は試してみました角度NG-repeatが、私は私が使用しています検索コントローラ持っ

<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> 

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" 
ここ

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'); 
    }; 

} 

はHTMLです

ここにAPIの返すイメージ(data.Results)があります。

enter image description here

EDIT私ははconsole.log(応答)を行うときに、

私は明らかにデータを正しく呼び出すことはできませんが、他に何を試してみるかはわかりません。私がここにいる理由です。

+0

'$ scope.fetch = function()'? –

+0

'response.data'の構造は何ですか?配列?オブジェクト?投稿してください。 – SteamDev

+0

データ。結果。そのオブジェクトとその内部には、ループを試みている配列があります。私は私の質問を編集しました。それを指摘してくれてありがとう。私はそれを追加することを忘れました。 – agon024

答えて

3

ng-repeat="res in details.Results"が必要です。

+0

ご協力いただきありがとうございます。いいぞ。 – agon024

関連する問題