How to get a directive for linking in dynamically loaded HTML in AngularJS?

Possible duplicate:
AngularJS + jQuery: how to make dynamic content work in angularjs

I have an application based on AngularJS 1.0.1 and Bootstrap 2.0.2.

The application dynamically loads views; I use angular.bootstrap() to compile and link these fragments, and the AngularJS function works fine, binds to my model and responds to events.

I want to put Bootstrap tooltip on some dynamic elements and created a directive for this (using the approach laid out by AlexFigueiredoo ). This approach works well when the AngularJS view is in static HTML, as you can see from jsFiddle.

However, when the same code is used in an environment where HTML is dynamically loaded, the popup does not work. When exploring, the 'tooltip' directive is now unlinked.

I have a test-case on jsFiddle. Lift the JS console to view messages.

Note that console.log never displays the factory directive being called, not to mention the connection.

Am I doing something wrong?

+4
source share
1 answer

I added the tooltip attribute to the end of the tag and it worked for me. Looks like you forgot the directive in a living example?

http://jsfiddle.net/CcRrN/

0
source

Source: https://habr.com/ru/post/1432221/


All Articles