Using textAngular inside ng-repeat with same name attribute value?
yulric opened this issue · comments
Hi there,
Thanks a lot for the directive. I am trying to use angularjs validation with textAngular but unfortunately I have run into a problem. I have an ng-repeat which repeats an ng-form inside of which I have a textAngular element. However the ng-repeat array can't have more than one element because I get the error "textAngular Error: An editor with the name already exists".I was wondering if there was a way to fix this problem. Thanks a lot for your help.
Edit: Made a plunker so you can see the problem http://plnkr.co/edit/xdbP7ouKOf4ySRRyaAo0
Once you run the plunker go to the console to see the issue
As the error suggests each textAngular directive requires a unique name attribute. There are two solutions to this:
- Remove the name attribute and let textAngular dynamically set the name itself (note that this can ).
- Use the following:
<div text-angular ng-model='item.Model' name='textAngularEditor{{$index}}'></div>
As you're using it inside an ng-form I'm assuming you want to be doing validation so you'll probably want to use option 2.
To help us improve textAngular what would a better error message have been?
Hi thanks for the reply. I think the error message is fine, it explains the problem pretty well. I thought this was an issue since the error was coming from angularjs and not textAngular but I guess I was wrong there. Maybe a note in the docs regarding this feature would be helpful in the future? Thanks for the possible solutions.
Can't this limitation be removed?