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);
}
};
});
添加回答
举报
0/150
提交
取消