Using textAngular inside ng-repeat with same name attribute value? #240

Closed
yulric opened this Issue Jul 14, 2014 · 3 comments

Projects

None yet

3 participants

@yulric
yulric commented Jul 14, 2014

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

@SimeonC
Collaborator
SimeonC commented Jul 14, 2014

As the error suggests each textAngular directive requires a unique name attribute. There are two solutions to this:

  1. Remove the name attribute and let textAngular dynamically set the name itself (note that this can ).
  2. 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?

@yulric
yulric commented Jul 15, 2014

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.

@SimeonC SimeonC pushed a commit that closed this issue Jan 20, 2015
SimeonC chore(README): Add FAQ entry for editor name error
Closes #240
5fefba1
@SimeonC SimeonC closed this in 5fefba1 Jan 20, 2015
@checat
checat commented Nov 10, 2015

Can't this limitation be removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment