This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($rootElement): added application root element
Publish the application root element as $rootElement so that it can be injected to other services.
- Loading branch information
Showing
5 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc overview | ||
* @name angular.module.ng.$rootElement | ||
* | ||
* @description | ||
* The root element of Angular application. This is either the element where {@link | ||
* angular.module.ng.$compileProvider.directive.ngApp ngApp} was declared or the element passed into | ||
* {@link angular.bootstrap}. The element represent the root element of application. It is also the | ||
* location where the applications {@link angular.module.AUTO.$injector $injector} service gets | ||
* published, it can be retrieved using `$rootElement.injector()`. | ||
*/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
describe('$rootElement', function() { | ||
it('should publish the bootstrap element into $rootElement', function() { | ||
var element = jqLite('<div></div>'); | ||
var injector = angular.bootstrap(element); | ||
|
||
expect(injector.get('$rootElement')[0]).toBe(element[0]); | ||
|
||
dealoc(element); | ||
}); | ||
}); |
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