【发布时间】:2017-01-13 17:43:05
【问题描述】:
我有 Component 定义如下:
@Component({
moduleId: module.id,
templateUrl: 'my.template.html',
animations: [
trigger('fadeInOut', [
state('in', style({opacity: 1})),
transition('void => *', [
style({
opacity: 0
}),
animate(500)
]),
transition('* => void', [
animate(500, style({
opacity: 0
}))
]),
])
]
})
export class MyComponent implements OnInit, OnDestroy {
public stage: number = 0;
...
transitionDone(transitionEvent: any): void {...}
...
}
模板看起来像这样:
<div
*ngIf="stage"
@fadeInOut
(@fadeInOut.done)="transitionDone($event)"
></div>
应用程序在使用 JIT 编译时工作正常,并且 done 回调被正确触发,但是当我尝试使用 ngc (v. 0.6.0) 编译它时,它给了我一个错误:
提供的参数与调用目标的任何签名都不匹配。
这是因为它为 AnimationOutput 生成参数数量错误的 ngfactory 文件:
this.registerAnimationOutput(
this._el_0,
new import24.AnimationOutput('fadeInOut','done'), <-- should be 3 args
this.eventHandler(this._handle__fadeInOut_done_0_1.bind(this))
);
如果我从模板中删除 done 回调,编译工作。
我正在使用 Angular 2 RC.6
【问题讨论】:
标签: javascript angular compiler-errors