2016-06-18 14 views
0

Das Changelog auf https://github.com/angular/angular/blob/master/CHANGELOG.md erwähnt migrieren:Angular 2.0.0-rc.2: Wie PLATFORM_DIRECTIVES

PLATFORM_PIPES und PLATFORM_DIRECTIVES jetzt sind Felder, auf CompilerConfig. Anstatt eine Bindung an diese Tokens bereitzustellen, geben Sie stattdessen eine Bindung für CompilerConfig an.

Bisher habe ich diese Zeilen in meiner Bootstrap-Datei:

bootstrap(
    AppComponent, 
    [... 
     provide(PLATFORM_DIRECTIVES, {useValue: ROUTER_DIRECTIVES, multi: true}), 
    ...]); 

Wie soll ich die Funktion zur Verfügung stellen() ändern? Jeder Hinweis wird geschätzt.

Antwort

0

habe ich die disableDeprecatedForms() Verfahren von hier als Leitfaden: https://github.com/angular/angular/blob/master/modules/@angular/forms/src/form_providers.ts

Also sollten Sie den Code in etwa so aussehen:

bootstrap(
AppComponent, 
[... 
    provide(CompilerConfig, { 
     useFactory: (platformDirectives: any[], platformPipes: any[]) => { 
      return new CompilerConfig({ 
       platformDirectives: platformDirectives.concat(...ROUTER_DIRECTIVES), 
       platformPipes: platformPipes 
      }); 
     }, 
     deps: [PLATFORM_DIRECTIVES, PLATFORM_PIPES]}), 
...]);