sdApp.directive("sdVerNumber", function(){
return{
restrict: "A",
replace: true,
template: "<input type=\"text\" ng-pattern=\"/^([1-9]+[0-9]*|[0])([.]+[0-9]{0,2}|[.])?$/\" />"
};
});
<input type="text" sd-ver-number class="sd-input-text sd-input-small" style="width:80px;" ng-model="addListData.m1" />當輸入內容錯誤的時候,對應狀態的類ng-invalid-pattern沒有相應改變。而直接把整個ng-pattern寫在HTML上是可以正常工作的。請問這是為什么呢?
AngularJS ng-pattern失效問題?
MYYA
2018-08-11 11:10:31