0

I have an application that contains a div with content in it. When I click a button jQuery adds a AngularJs directive to the div. After adding the directive i call scope.$apply(), but this doesn't seem to inform angular about the new directive on the div. Can someone explain to me how I can inform AngularJs about the new directive added with jQuery?

Subtubes
  • 15,851
  • 22
  • 70
  • 105

1 Answers1

2

You shouldn't be adding directives to your markup with JQuery. Use Angular for that whenever possible.

That said, if you have to add directives via straight DOM manipulations like that, you'll need to use the $compile provider to compile the element and bind it to a scope before you add it.

Ben Lesh
  • 107,825
  • 47
  • 247
  • 232