Created
May 6, 2014 09:45
-
-
Save shengoo/0186e068c4c853d703b2 to your computer and use it in GitHub Desktop.
use $compile outside a directive in Angularjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
// myApp for test directive to work, ng for $compile | |
var $injector = angular.injector(['ng', 'myApp']); | |
$injector.invoke(function($rootScope, $compile) { | |
$('body').prepend($compile('<div ng-attr-tooltip="test">Cancel</div>')($rootScope)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment