MCPcopy
hub / github.com/angular-ui/ui-router / angularInit

Function angularInit

test/angular/1.4/angular.js:1583–1610  ·  view source on GitHub ↗

* @ngdoc directive * @name ngApp * @module ng * * @element ANY * @param {angular.Module} ngApp an optional application * angular.module module name to load. * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be * created in "strict-d

(element, bootstrap)

Source from the content-addressed store, hash-verified

1581 </example>
1582 */
1583function angularInit(element, bootstrap) {
1584 var appElement,
1585 module,
1586 config = {};
1587
1588 // The element `element` has priority over any other element
1589 forEach(ngAttrPrefixes, function(prefix) {
1590 var name = prefix + 'app';
1591
1592 if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
1593 appElement = element;
1594 module = element.getAttribute(name);
1595 }
1596 });
1597 forEach(ngAttrPrefixes, function(prefix) {
1598 var name = prefix + 'app';
1599 var candidate;
1600
1601 if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
1602 appElement = candidate;
1603 module = candidate.getAttribute(name);
1604 }
1605 });
1606 if (appElement) {
1607 config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
1608 bootstrap(appElement, module ? [module] : [], config);
1609 }
1610}
1611
1612/**
1613 * @ngdoc function

Callers 1

angular.jsFile · 0.70

Calls 3

forEachFunction · 0.70
getNgAttributeFunction · 0.70
bootstrapFunction · 0.70

Tested by

no test coverage detected