1

I just have a question for the Angular heads. I am fighting on a problem with an autocomplete custom directive. My autocompletes events are loaded in a directive etc.

For some reasons I have to put an autocomplete input field in each line of a <table> element.

For that, I use the ng-repeat attribute. But none of the autocomplete fields are working.

When I remove the ng-repeat attribute, autocompletes are working...

So my question is, is there a known bug with this?

Thank you

1
  • 3
    pls add your code or even better e JSfiddle or sth similar Commented Jul 25, 2013 at 14:43

2 Answers 2

4

You need to transclude your directive.

Because your directive is nested in a ng-repeat the contents of the directive are not being compiled into the DOM, hence they are not working.

Directives have a transclude attribute and coupled with the ng-transclude tag will allow your directives to work when nested in a ng-repeat

Some Resources to get you started:

This article is a great starter for directives and has a nice introduction to transclusion.

Here is another source giving some examples of an transclude and compile in a ng-repeat.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your answer. I am checking it actually. I will tell you more :)
Thank you for your answer once again it seems to be solving my problem. Didn't know the concept of Tranclusion. Thank you
@JulienRodrigues Can you show your autocomplete directive?
2

This great article give a very complete description on how to build and autocomplete: http://hueypetersen.com/posts/2013/06/24/typeahead-with-angular/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.