@@ -3,36 +3,49 @@ import './polyfills/array';
33import './zone' ;
44import { isPresent , Type } from 'angular2/src/facade/lang' ;
55import { Promise , PromiseWrapper } from 'angular2/src/facade/async' ;
6- import { ComponentRef } from 'angular2/src/ core/linker/dynamic_component_loader ' ;
6+ import { platform , ComponentRef , PLATFORM_DIRECTIVES , PLATFORM_PIPES } from 'angular2/core' ;
77import { bind , provide , Provider } from 'angular2/src/core/di' ;
8- import { DOM } from 'angular2/src/core /dom/dom_adapter' ;
8+ import { DOM } from 'angular2/src/platform /dom/dom_adapter' ;
99
1010import { Renderer } from 'angular2/src/core/render/api' ;
1111import { NativeScriptRenderer } from './renderer' ;
1212import { NativeScriptDomAdapter } from './dom_adapter' ;
1313import { XHR } from 'angular2/src/compiler/xhr' ;
1414import { FileSystemXHR } from './xhr' ;
15- import { Parse5DomAdapter } from 'angular2/src/core/dom/parse5_adapter' ;
15+ import { Parse5DomAdapter } from 'angular2/src/platform/server/parse5_adapter' ;
16+ import { ExceptionHandler } from 'angular2/src/facade/exception_handler' ;
17+ import { APPLICATION_COMMON_PROVIDERS } from 'angular2/src/core/application_common_providers' ;
18+ import { COMPILER_PROVIDERS } from 'angular2/src/compiler/compiler' ;
19+ import { PLATFORM_COMMON_PROVIDERS } from 'angular2/src/core/platform_common_providers' ;
20+ import { COMMON_DIRECTIVES , COMMON_PIPES , FORM_PROVIDERS } from "angular2/common" ;
1621
17- import { bootstrap as angularBootstrap } from 'angular2/src/core/application' ;
18- import { commonBootstrap } from 'angular2/src/core/application_common' ;
22+ import { bootstrap as angularBootstrap } from 'angular2/bootstrap' ;
1923
20-
21- export type BindingArray = Array < Type | Provider | any [ ] > ;
24+ export type ProviderArray = Array < Type | Provider | any [ ] > ;
2225
2326export function nativeScriptBootstrap ( appComponentType : any ,
24- componentInjectableBindings : BindingArray = null ) : Promise < ComponentRef > {
27+ customProviders : ProviderArray = null ) : Promise < ComponentRef > {
2528 NativeScriptDomAdapter . makeCurrent ( ) ;
2629
27- let nativeScriptBindings : BindingArray = [
30+ let nativeScriptProviders : ProviderArray = [
2831 NativeScriptRenderer ,
2932 provide ( Renderer , { useClass : NativeScriptRenderer } ) ,
3033 provide ( XHR , { useClass : FileSystemXHR } ) ,
34+ provide ( ExceptionHandler , { useFactory : ( ) => new ExceptionHandler ( DOM , true ) , deps : [ ] } ) ,
35+
36+ provide ( PLATFORM_PIPES , { useValue : COMMON_PIPES , multi : true } ) ,
37+ provide ( PLATFORM_DIRECTIVES , { useValue : COMMON_DIRECTIVES , multi : true } ) ,
38+
39+ APPLICATION_COMMON_PROVIDERS ,
40+ COMPILER_PROVIDERS ,
41+ PLATFORM_COMMON_PROVIDERS ,
42+ FORM_PROVIDERS ,
3143 ] ;
32- var bindings = [ nativeScriptBindings ] ;
33- if ( isPresent ( componentInjectableBindings ) ) {
34- bindings . push ( componentInjectableBindings ) ;
44+
45+ var appProviders = [ ] ;
46+ if ( isPresent ( customProviders ) ) {
47+ appProviders . push ( customProviders ) ;
3548 }
3649
37- return angularBootstrap ( appComponentType , bindings )
50+ return platform ( nativeScriptProviders ) . application ( appProviders ) . bootstrap ( appComponentType ) ;
3851}
0 commit comments