0
假設有一個數組:
[{name:'a',display:'obj.a ===「1」},{name:' b',display:true}]
是否可以通過屬性顯示的實際值過濾數組?
in angularjs,如何通過包含表達式的屬性過濾數組
angular.module('myApp', [])
.controller('MyController', ['$scope', function ($scope) {
$scope.obj = {};
$scope.arr = [{name: 'a', display: 'obj.a==="1"'}, {name: 'b', display: true}];
}])
;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyController">
<input type="text" ng-model="obj.a">
<div>
<span ng-repeat="item in arr|filter:{display: true}">{{item.name}}</span>
</div>
</div>
仍然無法理解u能再次解釋 – Dhiraj