dontHaveName
dontHaveName

Reputation: 1937

angular.js - naming the form doesn't work

I have categories page where are listed all products with its forms. E.g.

<div ng-repeat="product in products">
   <form name="product[[ product.id ]]"></form> // [[]] custom angular syntax, result is product1,2,3
</div>

Then I have product page where is same form. When I try to apply same naming convention

<form name="product[[ product.id ]]"></form>

It just doesn't work. Result is just product. Why it doesn't accept that name? When I change it to something else e.g. coolName[[ product.id ]] it works(coolName1).

It's just acting weird. Also 1 directive(image jQuery slider, which should wait until dom is loaded) doesn't work for me on that page.

Any thoughts?

Upvotes: 1

Views: 27

Answers (1)

Razvan B.
Razvan B.

Reputation: 6771

That is happening because in your

<div ng-repeat="product in products">  <!-- product as repeater for products -->
   <form name="product[[ product.id ]]"></form> <!-- product get's value from repeater -->
</div>

You have to either change ng-repeat="something in products"

or

change the form name to <form name="something[product.id]">

Upvotes: 1

Related Questions