3

我刚刚从 angular 5 更新到 angular 6,我遇到了 angular 动画的问题。

我做了标准升级

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli --migrate-only --from=1.7.4
ng update @angular/core
npm install rxjs-compat (most project probably need this)
ng serve

我还根据官方升级指南(https://update.angular.io/)将我的代码库从 5.2 更新到了 6,但出现了一个错误,我无法弄清楚。

ERROR in src/app/dispute-center/shared/services/dispute-store-service.ts(1,22): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'transition'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,28): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'trigger'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,37): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'state'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,44): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'style'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,51): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'transition'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,63): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'animate'.

我想这是因为动画模块导入已经移动,但是它们移动到了哪个包下?

4

1 回答 1

15

从v6变更日志的重大变更部分:

core: it is no longer possible to import animation-related functions from @angular/core. All animation symbols must now be imported from @angular/animations.

trigger因此,您需要将, transition, animate, trigger,等的导入更新为statefrom@angular/animations而不是@angular/core.

于 2018-05-04T23:37:44.623 回答