MCPcopy Index your code
hub / github.com/angular-ui/ui-router / angularInit

Function angularInit

test/angular/1.5/angular.js:1685–1717  ·  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

1683 </example>
1684 */
1685function angularInit(element, bootstrap) {
1686 var appElement,
1687 module,
1688 config = {};
1689
1690 // The element `element` has priority over any other element.
1691 forEach(ngAttrPrefixes, function(prefix) {
1692 var name = prefix + 'app';
1693
1694 if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
1695 appElement = element;
1696 module = element.getAttribute(name);
1697 }
1698 });
1699 forEach(ngAttrPrefixes, function(prefix) {
1700 var name = prefix + 'app';
1701 var candidate;
1702
1703 if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
1704 appElement = candidate;
1705 module = candidate.getAttribute(name);
1706 }
1707 });
1708 if (appElement) {
1709 if (!isAutoBootstrapAllowed) {
1710 window.console.error('Angular: disabling automatic bootstrap. <script> protocol indicates ' +
1711 'an extension, document.location.href does not match.');
1712 return;
1713 }
1714 config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
1715 bootstrap(appElement, module ? [module] : [], config);
1716 }
1717}
1718
1719/**
1720 * @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