
以下代码自动过滤出input中的数字。
scope.$watch(attr['ngModel'], () => {
let modelValue = $parse(attr['ngModel'])(scope);
var data = (typeof modelValue === 'string') ? modelValue.replace(/D+/g, '') : modelValue;
$parse(attr['ngModel']).assign(scope, data);
});




近期评论