自定义filter
js代码:
.filter('currentCityFilter'(名称), [function () {
return function (city,(city第一个参数对应currentCity值;名称可以不一样) cityList,(第二个参数) three(第三个参数)) {
if (city.id == 104) {
return city.city + '当前城市';
} else {
return city.city
}
}
}]);
html代码:
<div layout="row">
<div ng-repeat="currentCity in $ctrl.currentCityList">
<md-button class="md-raised">
{{currentCity | currentCityFilter : $ctrl.currentCityList(第二个参数的值) : '3' }}
</md-button>
</div>
</div>