【发布时间】:2015-07-23 08:25:29
【问题描述】:
我已经设置了json格式的验证规则,它存储在工厂服务中。
"inputname":{
"rule":{
"required":"required", "ng-minlength":"3", "ng-maxlength":"16"
},
"error":{
"required":"Name is required",
"minlength":"Name must have atleast 3 characters",
"maxlength":"Name can have upto 16 characters"
}
},
我使用编译功能通过自定义指令将规则包含到输入元素中。现在规则已设置到输入字段并且表单验证正在工作。
我需要在 html 的不同部分显示错误。
我需要通过从服务中收集 json 中的错误来在 html 中打印 <ng-messages>。
如何将错误放在页面上?
【问题讨论】:
标签: javascript json angularjs