2

I am using AngularJS 1.4.7. I am using an ng-repeat in a div surrounded by form as follows

     <form name="myForm">
        <div ng-repeat="product in ProductList">
       <input name="ProductName" ng-model="ProductName">
</div>
</form>

When i validate errors show up on all the ProductNames even if its valid, i know i have to use ng-form but i can not get it to work

The Angular docs were not enough. And could not find a solution that works

Thanks

2
  • This is still a bit vague... Can you provide more information on what you're trying to do and provide some JS? Commented Oct 19, 2015 at 11:46
  • There is actually no JS involved so far. I think i found the solution though will mess around for a while then update Commented Oct 19, 2015 at 11:59

2 Answers 2

1

it's not a validation issue, you just have each input assigned to the same model. Try

<input name="ProductName[{{$index}}]" ng-model="product.name">
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry for the late reply mate, will try it after work today. It was late night here
0

change your line one to this : <form name="myForm" novalidate>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.