我用Angular -seed升级了一个Angular 4项目,现在得到了这个错误
找到合成属性@panelState。请在应用程序中包含“BrowserAnimationsModule”或“NoopAnimationsModule”。
我该如何解决这个问题?错误消息到底告诉我什么?
我用Angular -seed升级了一个Angular 4项目,现在得到了这个错误
找到合成属性@panelState。请在应用程序中包含“BrowserAnimationsModule”或“NoopAnimationsModule”。
我该如何解决这个问题?错误消息到底告诉我什么?
当前回答
针对angularJS 4的更新:
(SystemJS) XHR错误(404 Not Found)加载http://localhost:3000/node_modules/@angular/platform-browser/bundles/platform-browser.umd.js/animations
解决方案:
**cli:** (command/terminal)
npm install @angular/animations@latest --save
**systemjs.config.js** (edit file)
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
**app.module.ts** (edit file)
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
imports: [ BrowserModule,BrowserAnimationsModule ],
...
其他回答
针对angularJS 4的更新:
(SystemJS) XHR错误(404 Not Found)加载http://localhost:3000/node_modules/@angular/platform-browser/bundles/platform-browser.umd.js/animations
解决方案:
**cli:** (command/terminal)
npm install @angular/animations@latest --save
**systemjs.config.js** (edit file)
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
**app.module.ts** (edit file)
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
imports: [ BrowserModule,BrowserAnimationsModule ],
...
试试这个
NPM install @angular/animations@latest
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
这对我很有用。
对我来说是因为我把动画名放在方括号里。
<div [@animation]></div>
但在我拆除支架后,一切都正常工作:
<div @animation></div>
对于我来说,我错过了@Component decorator中的这句话: 动画(yourAnimation):
一旦我添加了这个语句,错误就消失了。 (角6. x)
简单地加上.. import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
协和进口:( … BrowserAnimationsModule
],
在app.module.ts文件中。
确保您已经安装。NPM install @angular/animations@latest