Angular ng messages show errors on ng repeat form

后端 未结 3 1532
醉酒成梦
醉酒成梦 2021-02-19 22:49

I want to generate inputs with ng repeat, the problem is when i have an error this is only apply on the last element, how can i make this apply per element?

<         


        
3条回答
  •  太阳男子
    2021-02-19 23:40

    I'm using ng-form and do following :

    1. Give the form name at the same level as ng-repeat
    2. Give the name attribute to your controls
    3. In the ng-message says formName.controlName.$error

      This field is required

提交回复
热议问题