一尘不染

angular2中的导航错误

node.js

更新后,我已将角度包版本从2.4.10更新到4.0.0,导航时出现以下错误。

ERROR Error: Uncaught (in promise): Error: Found the synthetic property @transformPlaceholder. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
Error: Found the synthetic property @transformPlaceholder. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application

而且我更改了webpack.common.js配置。见下面的代码

 new webpack.ContextReplacementPlugin(
            // The (\\|\/) piece accounts for path separators in *nix and Windows
            /angular(\\|\/)core(\\|\/)@angular/,
            helpers.root('./src'), // location of your src
            {} // a map of your routes
        ),

阅读 182

收藏
2020-07-07

共1个答案

一尘不染

我已经解决了这个问题。我添加了一个新包:@angular/animations

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

我导入了模块:

@NgModule({
    imports: [
        BrowserAnimationsModule
    ]
})
2020-07-07