@@ -6,22 +6,21 @@ import './polyfills/array';
66import { rendererLog , rendererError } from "./trace" ;
77import { SanitizationService } from '@angular/core/src/security' ;
88import { isPresent , Type , print } from '@angular/core/src/facade/lang' ;
9- import { ReflectiveInjector , reflector , coreLoadAndBootstrap , createPlatform ,
10- getPlatform , assertPlatform , ComponentRef , PlatformRef , PLATFORM_DIRECTIVES , PLATFORM_PIPES } from '@angular/core' ;
9+ import { ReflectiveInjector , coreLoadAndBootstrap , createPlatform ,
10+ getPlatform , assertPlatform , ComponentRef , PlatformRef , PLATFORM_DIRECTIVES , PLATFORM_PIPES } from '@angular/core' ;
1111import { bind , provide , Provider } from '@angular/core/src/di' ;
1212
1313import { RootRenderer , Renderer } from '@angular/core/src/render/api' ;
1414import { NativeScriptRootRenderer , NativeScriptRenderer } from './renderer' ;
1515import { NativeScriptDomAdapter , NativeScriptElementSchemaRegistry , NativeScriptSanitizationService } from './dom_adapter' ;
16- import { ElementSchemaRegistry , XHR , COMPILER_PROVIDERS } from '@angular/compiler' ;
16+ import { ElementSchemaRegistry , XHR , COMPILER_PROVIDERS , CompilerConfig } from '@angular/compiler' ;
1717import { FileSystemXHR } from './xhr' ;
1818import { Parse5DomAdapter } from '@angular/platform-server/src/parse5_adapter' ;
1919import { ExceptionHandler } from '@angular/core/src/facade/exception_handler' ;
2020import { APPLICATION_COMMON_PROVIDERS } from '@angular/core/src/application_common_providers' ;
2121import { PLATFORM_COMMON_PROVIDERS } from '@angular/core/src/platform_common_providers' ;
2222import { COMMON_DIRECTIVES , COMMON_PIPES , FORM_PROVIDERS } from "@angular/common" ;
2323import { NS_DIRECTIVES } from './directives' ;
24- import { ReflectionCapabilities } from '@angular/core/src/reflection/reflection_capabilities' ;
2524
2625import { Page } from 'ui/page' ;
2726import { TextView } from 'ui/text-view' ;
@@ -40,12 +39,27 @@ export interface AppOptions {
4039}
4140
4241class ConsoleLogger {
43- log = print ;
44- logError = print ;
45- logGroup = print ;
46- logGroupEnd ( ) { }
42+ log = print ;
43+ logError = print ;
44+ logGroup = print ;
45+ logGroupEnd ( ) { }
4746}
4847
48+ // See: https://github.com/angular/angular/commit/1745366530266d298306b995ecd23dabd8569e28
49+ export const NS_COMPILER_PROVIDERS : ProviderArray = [
50+ COMPILER_PROVIDERS ,
51+ provide ( CompilerConfig , {
52+ useFactory : ( platformDirectives : any [ ] , platformPipes : any [ ] ) => {
53+ return new CompilerConfig ( { platformDirectives, platformPipes } ) ;
54+ } ,
55+ deps : [ PLATFORM_DIRECTIVES , PLATFORM_PIPES ]
56+ } ) ,
57+ provide ( XHR , { useClass : FileSystemXHR } ) ,
58+ provide ( PLATFORM_PIPES , { useValue : COMMON_PIPES , multi : true } ) ,
59+ provide ( PLATFORM_DIRECTIVES , { useValue : COMMON_DIRECTIVES , multi : true } ) ,
60+ provide ( PLATFORM_DIRECTIVES , { useValue : NS_DIRECTIVES , multi : true } )
61+ ] ;
62+ 4963export function bootstrap ( appComponentType : any ,
5064 customProviders : ProviderArray = null ) : Promise < ComponentRef < any > > {
5165 NativeScriptDomAdapter . makeCurrent ( ) ;
@@ -57,12 +71,11 @@ export function bootstrap(appComponentType: any,
5771 let defaultAppProviders : ProviderArray = [
5872 APPLICATION_COMMON_PROVIDERS ,
5973 FORM_PROVIDERS ,
60- provide ( PLATFORM_PIPES , { useValue : COMMON_PIPES , multi : true } ) ,
61- provide ( PLATFORM_DIRECTIVES , { useValue : COMMON_DIRECTIVES , multi : true } ) ,
62- provide ( PLATFORM_DIRECTIVES , { useValue : NS_DIRECTIVES , multi : true } ) ,
63- provide ( ExceptionHandler , { useFactory : ( ) => {
64- return new ExceptionHandler ( new ConsoleLogger ( ) , true )
65- } , deps : [ ] } ) ,
74+ provide ( ExceptionHandler , {
75+ useFactory : ( ) => {
76+ return new ExceptionHandler ( new ConsoleLogger ( ) , true )
77+ } , deps : [ ]
78+ } ) ,
6679
6780 defaultPageProvider ,
6881 defaultDeviceProvider ,
@@ -72,7 +85,7 @@ export function bootstrap(appComponentType: any,
7285 provide ( Renderer , { useClass : NativeScriptRenderer } ) ,
7386 provide ( SanitizationService , { useClass : NativeScriptSanitizationService } ) ,
7487 provide ( ElementSchemaRegistry , { useClass : NativeScriptElementSchemaRegistry } ) ,
75- COMPILER_PROVIDERS ,
88+ NS_COMPILER_PROVIDERS ,
7689 provide ( ElementSchemaRegistry , { useClass : NativeScriptElementSchemaRegistry } ) ,
7790 provide ( XHR , { useClass : FileSystemXHR } ) ,
7891 ]
@@ -82,14 +95,14 @@ export function bootstrap(appComponentType: any,
8295 appProviders . push ( customProviders ) ;
8396 }
8497
85- var platform = getPlatform ( ) ;
98+ var platform = getPlatform ( ) ;
8699 if ( ! isPresent ( platform ) ) {
87100 platform = createPlatform ( ReflectiveInjector . resolveAndCreate ( platformProviders ) ) ;
88101 }
89-
90- reflector . reflectionCapabilities = new ReflectionCapabilities ( ) ;
102+ 103+ // reflector.reflectionCapabilities = new ReflectionCapabilities();
91104 var appInjector = ReflectiveInjector . resolveAndCreate ( appProviders , platform . injector ) ;
92- return coreLoadAndBootstrap ( appInjector , appComponentType ) ;
105+ return coreLoadAndBootstrap ( appComponentType , appInjector ) ;
93106}
94107
95108export function nativeScriptBootstrap ( appComponentType : any , customProviders ?: ProviderArray , appOptions ?: AppOptions ) : Promise < ComponentRef < any > > {
@@ -105,7 +118,7 @@ export function nativeScriptBootstrap(appComponentType: any, customProviders?: P
105118 page . actionBarHidden = appOptions . startPageActionBarHidden ;
106119 }
107120
108- let onLoadedHandler = function ( args ) {
121+ let onLoadedHandler = function ( args ) {
109122 page . off ( 'loaded' , onLoadedHandler ) ;
110123 //profiling.stop('application-start');
111124 rendererLog ( 'Page loaded' ) ;
0 commit comments