Angular 2.0.0-rc.2: How to migrate PLATFORM_DIRECTIVES

后端 未结 1 1606
轻奢々
轻奢々 2021-01-26 13:01

The changelog at https://github.com/angular/angular/blob/master/CHANGELOG.md mentions:

PLATFORM_PIPES and PLATFORM_DIRECTIVES now are fields on Compiler

相关标签:
1条回答
  • 2021-01-26 13:35

    I used the disableDeprecatedForms() method from here as a guide: https://github.com/angular/angular/blob/master/modules/@angular/forms/src/form_providers.ts

    So your code should look something like:

        bootstrap(
    AppComponent,
    [...
        provide(CompilerConfig, {
            useFactory: (platformDirectives: any[], platformPipes: any[]) => {
                return new CompilerConfig({
                    platformDirectives: platformDirectives.concat(...ROUTER_DIRECTIVES),
                    platformPipes: platformPipes
                });
            },
            deps: [PLATFORM_DIRECTIVES, PLATFORM_PIPES]}),
    ...]);
    
    0 讨论(0)
提交回复
热议问题