MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / angularInit

Function angularInit

web/static/bower_components/angular/angular.js:1547–1574  ·  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

1545 </example>
1546 */
1547function angularInit(element, bootstrap) {
1548 var appElement,
1549 module,
1550 config = {};
1551
1552 // The element `element` has priority over any other element
1553 forEach(ngAttrPrefixes, function(prefix) {
1554 var name = prefix + 'app';
1555
1556 if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
1557 appElement = element;
1558 module = element.getAttribute(name);
1559 }
1560 });
1561 forEach(ngAttrPrefixes, function(prefix) {
1562 var name = prefix + 'app';
1563 var candidate;
1564
1565 if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
1566 appElement = candidate;
1567 module = candidate.getAttribute(name);
1568 }
1569 });
1570 if (appElement) {
1571 config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
1572 bootstrap(appElement, module ? [module] : [], config);
1573 }
1574}
1575
1576/**
1577 * @ngdoc function

Callers 1

angular.jsFile · 0.85

Calls 3

forEachFunction · 0.85
getNgAttributeFunction · 0.85
bootstrapFunction · 0.85

Tested by

no test coverage detected