angularjs - Angular JS filter equals -
please see details . why output wrong?
html code :
<div ng-app> <div ng-controller="todoctrl"> <h1>list</h1> <div ng-repeat="t in todos | filter:{ id: '-1'}">{{t.text}}</div> </div> </div>
anfular code :
function todoctrl($scope) { $scope.todos = [{ text: 'learn angular', done: true, id: -1 },{ text: 'learn angular 2', done: true, id: -11 }, { text: 'build angular app', done: false, id: 1 }]; }
output :
learn angular larn angular 2
please see :
filter:{ id: '-1'}
why output follows:
learn angular
i want search equal '-1' , 'learn angular 2' -11
remove quotes '-1' , send true
filter strict comparison.
ng-repeat="t in todos | filter:{ id: -1}:true"
angularjs
No comments:
Post a Comment