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

Function angularInit

test/angular/1.3/angular.js:1345–1372  ·  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

1343 </example>
1344 */
1345function angularInit(element, bootstrap) {
1346 var appElement,
1347 module,
1348 config = {};
1349
1350 // The element `element` has priority over any other element
1351 forEach(ngAttrPrefixes, function(prefix) {
1352 var name = prefix + 'app';
1353
1354 if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
1355 appElement = element;
1356 module = element.getAttribute(name);
1357 }
1358 });
1359 forEach(ngAttrPrefixes, function(prefix) {
1360 var name = prefix + 'app';
1361 var candidate;
1362
1363 if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
1364 appElement = candidate;
1365 module = candidate.getAttribute(name);
1366 }
1367 });
1368 if (appElement) {
1369 config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
1370 bootstrap(appElement, module ? [module] : [], config);
1371 }
1372}
1373
1374/**
1375 * @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