angular2中的导航错误 [英] Navigation Error in angular2

查看:100
本文介绍了angular2中的导航错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have updated the angular packages version from 2.4.10 to 4.0.0 after updating i am getting the following errors while navigating.

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配置.看到下面的代码

And i changed the webpack.common.js configuration. see the below code

 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
        ),

推荐答案

我已解决此问题.我添加了一个新程序包:@angular/animations.

I have fixed the issue. I added a new package: @angular/animations.

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

然后我导入了模块:

@NgModule({
    imports: [
        BrowserAnimationsModule
    ]
})

这篇关于angular2中的导航错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆