angular.module('yourModule').directive('bindIf', function() { return {
restrict: 'A', require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
function parser(value) {
var show = scope.$eval(attrs.bindIf); return show ? value: '';
}
ngModel.$parsers.push(parser);
}
};
});
angular問(wèn)下這個(gè)$parsers是什么意思?
胡子哥哥
2018-09-04 13:17:02