Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
angularjs isolateApp
.directive('isolateApp', function ($injector, $interval, User) {
return {
scope: {},
restrict: 'E',
compile: function (element, attrs) {
var html = element.html();
element.html('');
return function (scope, element) {
scope.$destroy();
var newRoot = document.createElement('div');
newRoot.innerHTML = html;
angular.bootstrap(newRoot, [attrs['app']]);
element.append(newRoot);
$interval.cancel(checkLazyIsLoaded);
};
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.