Compile dynamic template from outside of angular === I want to load dynamic HTML content via AJAX, then compile it, because it contains angular directives. ```html Compile dynamic HTML
``` We can get reference to `$compile` outside of angular via `injector().invoke()`. ```javascript jQuery(document).ready(function($){ $('.foo').on('click',function(e){ e.preventDefault(); angular.element(document).injector().invoke(function($compile){ var obj=$('[obj]'); // get wrapper var scope=obj.scope(); // get scope // generate dynamic content obj.html($('{{test}}')); // compile!!! $compile(obj.contents())(scope); }); }); }); ```