84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
控制器:$scope.dataList=[
{"dataClass":"0","dataName":"A1"}, {"dataClass":"0","dataName":"A2"}, {"dataClass":"1","dataName":"B1"}, {"dataClass":"1","dataName":"B2"}, {"dataClass":"2","dataName":"C1"}, {"dataClass":"2","dataName":"C2"}
]HTML模板:
I wrote a filter for you and removed the specified dataClass:
angular.module('common', []).filter('myFilter', function () { return function (collection, keyname,value) { var output = []; angular.forEach(collection, function (item) { //过滤数组中值与指定值相同的元素 if(item[keyname]!=value){ output.push(item); } }); return output; } });
{{x.dataClass}}---{{x.dataName}}
The filter receives 3 parameters, the original array, the key to be filtered, and the specified key value.
repeat="item in dataList |filter :{'dataClass':{{varity}} }"
Just add curly brackets
I wrote a filter for you and removed the specified dataClass:
The filter receives 3 parameters, the original array, the key to be filtered, and the specified key value.
Just add curly brackets