在下面的代码中,没有像definitions
这样的内容,但仍然出现此错误:
Error: (SystemJS) Cannot read property 'definitions' of undefined
TypeError: Cannot read property 'definitions' of undefined
见下面的代码:
dashboard.component.ts:
import { Component, OnInit,HostBinding } from '@angular/core';
import { slideAnimation } from './animations/animations';
@Component({
moduleId:module.id,
selector:'my-dashboard',
templateUrl: 'dashboard.component.html',
styleUrls: [ 'dashboard.component.css' ],
animations: [ slideAnimation ]
})
export class DashboardComponent implements OnInit{
@HostBinding('@routeAnimation') routeAnimation = true;
@HostBinding('style.display') display = 'block';
@HostBinding('style.position') position = 'absolute';
ngOnInit(): void {
}
}
animation.ts:
import { animate, AnimationEntryMetadata, state, style, transition, trigger } from '@angular/core';
export const slideInDownAnimation: AnimationEntryMetadata =
trigger('routeAnimation', [
state('*',
style({
opacity: 1,
transform: 'translateX(0)'
})
)
]);
答案 0 :(得分:1)
得到答案:
我应该使用
import { slideInDownAnimation } from './animations/animations';
代替
import { SomthingElse } from './animations/animations';
我要导入的任何地方。