@@ -6,22 +6,21 @@ import './polyfills/array';
6
6
import { rendererLog , rendererError } from "./trace" ;
7
7
import { SanitizationService } from '@angular/core/src/security' ;
8
8
import { 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' ;
11
11
import { bind , provide , Provider } from '@angular/core/src/di' ;
12
12
13
13
import { RootRenderer , Renderer } from '@angular/core/src/render/api' ;
14
14
import { NativeScriptRootRenderer , NativeScriptRenderer } from './renderer' ;
15
15
import { 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' ;
17
17
import { FileSystemXHR } from './xhr' ;
18
18
import { Parse5DomAdapter } from '@angular/platform-server/src/parse5_adapter' ;
19
19
import { ExceptionHandler } from '@angular/core/src/facade/exception_handler' ;
20
20
import { APPLICATION_COMMON_PROVIDERS } from '@angular/core/src/application_common_providers' ;
21
21
import { PLATFORM_COMMON_PROVIDERS } from '@angular/core/src/platform_common_providers' ;
22
22
import { COMMON_DIRECTIVES , COMMON_PIPES , FORM_PROVIDERS } from "@angular/common" ;
23
23
import { NS_DIRECTIVES } from './directives' ;
24
- import { ReflectionCapabilities } from '@angular/core/src/reflection/reflection_capabilities' ;
25
24
26
25
import { Page } from 'ui/page' ;
27
26
import { TextView } from 'ui/text-view' ;
@@ -40,12 +39,27 @@ export interface AppOptions {
40
39
}
41
40
42
41
class ConsoleLogger {
43
- log = print ;
44
- logError = print ;
45
- logGroup = print ;
46
- logGroupEnd ( ) { }
42
+ log = print ;
43
+ logError = print ;
44
+ logGroup = print ;
45
+ logGroupEnd ( ) { }
47
46
}
48
47
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
+
49
63
export function bootstrap ( appComponentType : any ,
50
64
customProviders : ProviderArray = null ) : Promise < ComponentRef < any > > {
51
65
NativeScriptDomAdapter . makeCurrent ( ) ;
@@ -57,12 +71,11 @@ export function bootstrap(appComponentType: any,
57
71
let defaultAppProviders : ProviderArray = [
58
72
APPLICATION_COMMON_PROVIDERS ,
59
73
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
+ } ) ,
66
79
67
80
defaultPageProvider ,
68
81
defaultDeviceProvider ,
@@ -72,7 +85,7 @@ export function bootstrap(appComponentType: any,
72
85
provide ( Renderer , { useClass : NativeScriptRenderer } ) ,
73
86
provide ( SanitizationService , { useClass : NativeScriptSanitizationService } ) ,
74
87
provide ( ElementSchemaRegistry , { useClass : NativeScriptElementSchemaRegistry } ) ,
75
- COMPILER_PROVIDERS ,
88
+ NS_COMPILER_PROVIDERS ,
76
89
provide ( ElementSchemaRegistry , { useClass : NativeScriptElementSchemaRegistry } ) ,
77
90
provide ( XHR , { useClass : FileSystemXHR } ) ,
78
91
]
@@ -82,14 +95,14 @@ export function bootstrap(appComponentType: any,
82
95
appProviders . push ( customProviders ) ;
83
96
}
84
97
85
- var platform = getPlatform ( ) ;
98
+ var platform = getPlatform ( ) ;
86
99
if ( ! isPresent ( platform ) ) {
87
100
platform = createPlatform ( ReflectiveInjector . resolveAndCreate ( platformProviders ) ) ;
88
101
}
89
-
90
- reflector . reflectionCapabilities = new ReflectionCapabilities ( ) ;
102
+
103
+ // reflector.reflectionCapabilities = new ReflectionCapabilities();
91
104
var appInjector = ReflectiveInjector . resolveAndCreate ( appProviders , platform . injector ) ;
92
- return coreLoadAndBootstrap ( appInjector , appComponentType ) ;
105
+ return coreLoadAndBootstrap ( appComponentType , appInjector ) ;
93
106
}
94
107
95
108
export function nativeScriptBootstrap ( appComponentType : any , customProviders ?: ProviderArray , appOptions ?: AppOptions ) : Promise < ComponentRef < any > > {
@@ -105,7 +118,7 @@ export function nativeScriptBootstrap(appComponentType: any, customProviders?: P
105
118
page . actionBarHidden = appOptions . startPageActionBarHidden ;
106
119
}
107
120
108
- let onLoadedHandler = function ( args ) {
121
+ let onLoadedHandler = function ( args ) {
109
122
page . off ( 'loaded' , onLoadedHandler ) ;
110
123
//profiling.stop('application-start');
111
124
rendererLog ( 'Page loaded' ) ;
0 commit comments