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)があります。
EDIT私ははconsole.log(応答)を行うときに、
私は明らかにデータを正しく呼び出すことはできませんが、他に何を試してみるかはわかりません。私がここにいる理由です。
'$ scope.fetch = function()'? –
'response.data'の構造は何ですか?配列?オブジェクト?投稿してください。 – SteamDev
データ。結果。そのオブジェクトとその内部には、ループを試みている配列があります。私は私の質問を編集しました。それを指摘してくれてありがとう。私はそれを追加することを忘れました。 – agon024