Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

yulric opened this issue Jul 14, 2014 · 3 comments

Comments

@yulric
Copy link

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
Copy link
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
Copy link
Author

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.

@pelepelin
Copy link

Can't this limitation be removed?

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

No branches or pull requests

3 participants