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); } }; });
牧羊人nacy
相关分类