示例:注册页

以下的应用:

ng:

  • ng-pattern

  • ng-class='{className, condition}' 当条件为真,则使用class

  • ng-pattern

  • ng-required

  • ng-model

  • ng-minlength

  • ng-maxlength

  • ng-disabled

事件:

  • ng-checked

  • ng-click

  • ng-repeat

  • ng-change

form 字段

  • Form.field.$dirty 字段被改变

  • Form.field.$error 字段错误信息

  • Form.field.$invalid 为通过验证,字段无效

  • Form.$invalid

  • Form.$setPristine();

    该方法用于设置控制到原始状态。

    该方法可以移除'ng-dirty'类并将控制恢复到原始状态('ng-pristine'类)。 其他:

自定义.filter 自定义指令.directive

注意:初始化,和重置

效果:

例子:

index.html

app/index.js

Last updated

Was this helpful?