11import {
22 assertNotHasOwnProperty ,
33 errorHandlingConfig ,
4- getNgAttribute ,
54 hasOwn ,
65 isArray ,
76 minErr ,
@@ -26,24 +25,27 @@ const ngMinErr = minErr("ng");
2625
2726const $injectorMinErr = minErr ( "$injector" ) ;
2827
28+ const STRICT_DI = "strict-di" ;
29+
2930/** @type {Object.<string, NgModule> } */
3031const moduleRegistry = { } ;
3132
3233export class Angular {
3334 constructor ( ) {
34- /** @public */
35- this . $cache = Cache ;
35+ /* @ignore */
36+ this . _ $cache = Cache ;
3637
3738 /** @public @type {ng.PubSubService } */
3839 this . $eventBus = EventBus ;
3940
4041 /**
42+ * @public
4143 * @type {string } `version` from `package.json`
4244 */
4345 this . version = "[VI]{version}[/VI]" ; //inserted via rollup plugin
4446
4547 /** @type {!Array<string|any> } */
46- this . bootsrappedModules = [ ] ;
48+ this . _bootsrappedModules = [ ] ;
4749
4850 /**
4951 * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
@@ -194,10 +196,10 @@ export class Angular {
194196 }
195197
196198 if ( isArray ( modules ) ) {
197- this . bootsrappedModules = modules ;
199+ this . _bootsrappedModules = modules ;
198200 }
199201
200- this . bootsrappedModules . unshift ( [
202+ this . _bootsrappedModules . unshift ( [
201203 "$provide" ,
202204 /**
203205 * @param {import('./interface.ts').Provider } $provide
@@ -207,9 +209,9 @@ export class Angular {
207209 } ,
208210 ] ) ;
209211
210- this . bootsrappedModules . unshift ( "ng" ) ;
212+ this . _bootsrappedModules . unshift ( "ng" ) ;
211213
212- const injector = createInjector ( this . bootsrappedModules , config . strictDi ) ;
214+ const injector = createInjector ( this . _bootsrappedModules , config . strictDi ) ;
213215
214216 injector . invoke ( [
215217 $t . $rootScope ,
@@ -278,6 +280,7 @@ export class Angular {
278280 * @param {Element|Document } element
279281 */
280282 init ( element ) {
283+ /** @type {Element } */
281284 let appElement ;
282285
283286 let module ;
@@ -292,12 +295,9 @@ export class Angular {
292295 /** @type {Element } */ ( element ) . hasAttribute &&
293296 /** @type {Element } */ ( element ) . hasAttribute ( name )
294297 ) {
295- appElement = element ;
298+ appElement = /** @type { Element } */ ( element ) ;
296299 module = /** @type {Element } */ ( element ) . getAttribute ( name ) ;
297300 }
298- } ) ;
299- ngAttrPrefixes . forEach ( ( prefix ) => {
300- const name = `${ prefix } app` ;
301301
302302 let candidate ;
303303
@@ -311,7 +311,9 @@ export class Angular {
311311 } ) ;
312312
313313 if ( appElement ) {
314- config . strictDi = getNgAttribute ( appElement , "strict-di" ) !== null ;
314+ config . strictDi =
315+ appElement . hasAttribute ( STRICT_DI ) ||
316+ appElement . hasAttribute ( `data-${ STRICT_DI } ` ) ;
315317 this . bootstrap ( appElement , module ? [ module ] : [ ] , config ) ;
316318 }
317319 }
0 commit comments