Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在Dart代码中获取ng-model验证状态大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我用的时候
<input type='text' maxlength='25' required ng-model='ctrl.inputValue'>@H_502_2@ 
 

Angular向元素添加了几个类,例如ng-valid,ng-invalid,ng-dirty,ng-prisTine,允许显示有关验证结果的可视指示符.

在Dart代码中有没有办法达到这些状态?

好的,所以我刚才看到了这个:

请使用以下代码(表单和名称很重要!):

<div test>
    <form name="myForm">
         <input type='text' name="myInput" maxlength='25' required ng-model='ctrl.inputValue'>
    </form>
</div>@H_502_2@ 
 

然后是以下指令/ controller / component:

@NgController (
SELEctor: "[test]",publishAs: "ctrl"
)
class TESTController {
  String inputValue;
  Scope thisScope;
  TESTController (Scope this.thisScopE) {
    thisScope.$watch("ctrl.inputValue",() { 
      NgModel inputModel = thisScope["myForm"]["myInput"];
      print(inputModel.invalid);
    });
  }
}@H_502_2@ 
 

这将输出模型是否有效.

在此处查看NgModel的文档以获取其他字段:
http://ci.angularjs.org/view/Dart/job/angular.dart-master/javadoc/angular.directive/NgModel.html

大佬总结

以上是大佬教程为你收集整理的在Dart代码中获取ng-model验证状态全部内容,希望文章能够帮你解决在Dart代码中获取ng-model验证状态所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。