Created
December 29, 2012 17:51
-
-
Save ericzou/4408318 to your computer and use it in GitHub Desktop.
Manually bootstrap Angular JS
This file contains 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
window.onload = function() { | |
var $rootElement = angular.element(window.document); | |
var modules = ['ng', 'myApp', function($provide) { | |
$provide.value('$rootElement', $rootElement); | |
}]; | |
var $injector = angular.injector(modules); | |
var $compile = $injector.get('$compile'); | |
var compositeLinkFn = $compile($rootElement); | |
var $rootScope = $injector.get('$rootScope'); | |
compositeLinkFn($rootScope); | |
$rootScope.$apply(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment