0

私はすべての私のcameraidを表示するには、あまりにも私のデータを検索する先行入力を使用していますが、それは私に[object Object]を示しているとして、それは私に先行入力上の任意のデータを与えていないを使用して入力します。データなしブートストラップとangularJS

誰もが私を助けることができますか?

enter image description here

私のhtmlファイル:

<div class="container-fluid"> 

<h1><a href="http://localhost:8081/"><span class="glyphicon glyphicon-home 
">Image Viewer</span></a></h1> 
</div> 
<br> 
<div ng-controller="Hello" class="col-xs-12"> 


<b>Search:</b><br> 

<input type="text" ng-model="searchBox" uib-typeahead="state for state in records | filter:$viewValue | limitTo:8" class="form-control">   

<table class="table table-striped table-hover" style="width:55%"> 
    <thead> 
     <tr> 

     <th>CamID</th> 
     <th>Timestamp</th> 
     <th>View Image</th> 

     </tr> 
    </thead> 

    <tbody> 
     <tr ng-repeat="record in records | filter:searchBox | orderBy:'+timestamp'"> 

     <td>{{record.cameraid}}</td> 
     <td>{{record.timestamp}}</td> 
     <td>{{record.filename}}</td> 
     <td><button class="btn btn-primary" ng-click="toggleCustom()" onclick="myFunction()">View</button></td> 

     </tr> 
    </tbody> 
    </table> 

私のJSPファイル:

var camListApp = angular.module('camListApp', ['ui.bootstrap']) 
camListApp.controller("Hello", ["$scope", "$http", function($scope, $http){ 

$scope.custom = true; 
$scope.toggleCustom = function() { 
    $scope.custom = ! $scope.custom; 
}; 

$http.get('http://localhost:8081/camera/list').then(function(response) { 
    console.log(response); 
     $scope.records= response.data; 
    }); 
}]); 

私のJSONデータ:

[{"id":23,"cameraid":"001","timestamp":"2016/06/15 17:27","filename":"452c5d867b563e937d44d48ebc326c7a"}, 
{"id":24,"cameraid":"000000006f4280af","timestamp":"2016/06/15 17:27","filename":"ee90428e4e0c19ba9858285398bf4fbb"}, 
{"id":25,"cameraid":"002","timestamp":"2016/06/15 17:28","filename":"c9a4fb339f6981ffd679937724167de8"}, 
{"id":26,"cameraid":"000000006f4280af","timestamp":"2016/06/15 17:28","filename":"a1df86417d958e670750cf8172a2b7dd"} 
+0

私はあなたがカスタムフィルタを作る必要があると思うこのリンク[http://stackoverflow.com/questions/15196161/angularjs-how-to-structure-a-custom-filter-with-ng-repeat-to-return -items-cond](http://stackoverflow.com/questions/15196161/angularjs-how-to-structure-a-custom-filter-with-ng-repeat-to-return-items-cond) –

+0

私は私の検索をフィルターにかけるが、私のデータは私には見えない。 –

答えて

1

実際には、「オブジェクトオブジェクト」を取得するすべてのオブジェクトを戻しているため、使用する部分を指定する必要があります。

uib-typeahead="state.cameraid as state.cameraid for state in records | filter:$viewValue | limitTo:8"

最初state.cameraidは、あなたが第二の値であり、リストに表示するものです。

関連する問題