gpt4 book ai didi

Angular 4 - 请在您的应用程序中包含 "BrowserAnimationsModule"或 "NoopAnimationsModule"

转载 作者:行者123 更新时间:2023-12-03 17:18:20 25 4
gpt4 key购买 nike

当我在浏览器上启动 Angular 应用程序时遇到问题。一切正常的代码,但我仍然收到此错误:

Found the synthetic property @routerAnimations. Please include eitherBrowserAnimationsModule or NoopAnimationsModule in yourapplication.


我已经查看了关于这个主题的帖子,有很多,但他们的回答都是一样的:
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
并将其包含在应用程序模块的导入中。
imports: [
BrowserAnimationsModule,
...
]
这就是我所做的,但仍然遇到同样的错误。我一直在寻找这个解决方案的几个小时。任何人都知道什么可以解决它?谢谢
这是我的 package.json:
{
"name": "angular-bc",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.3",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}
}
组件:从答案复制
<div [@routerAnimations]="myOutlet.state">
<router-outlet #myOutlet></router-outlet>
</div>

最佳答案

添加行

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


imports: [
BrowserAnimationsModule,
...
]

app.module.ts实际上解决了它

关于Angular 4 - 请在您的应用程序中包含 "BrowserAnimationsModule"或 "NoopAnimationsModule",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46683027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com