意外的管道值上组件的视图“未定义” [英] Unexpected piped value 'undefined' on the View of component

查看:205
本文介绍了意外的管道值上组件的视图“未定义”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我常常会看到那个问题:意外的指导价值未定义......,但我得到一个不同的错误意外的管道值未定义......

I often saw the question "Unexpected directive value 'undefined'..." but I get a different error for "Unexpected piped value 'undefined'...".

首先,我当我试图我的自定义@Directive注入到我的构件得到这个错误。我没有找到一个解决办法呢。但是我想从我的部件拆下管和它的工作。

First I got this error when I tried to inject my custom @Directive to my component. I did not find a solution yet. But I tried to remove the pipe from my component and it worked.

所以这个作品:

@Component({
    selector: 'my-app',
    templateUrl: 'app/templates/app.component.html',
    pipes: [TranslatePipe],
})
export class MyApp {}

这也工作:

@Component({
    selector: 'my-app',
    templateUrl: 'app/templates/app.component.html',
    directives: [TranslateDirective],
})
export class MyApp {}

但是,这并不:

@Component({
    selector: 'my-app',
    templateUrl: 'app/templates/app.component.html',
    pipes: [TranslatePipe],
    directives: [TranslateDirective],
})
export class MyApp {}

它是一个开放的问题?难道我发现了错误?抑或是根本就没有记录在案,我做什么了吗?

Is it an open issue? Did I find a bug? Or is it simply not documented and I'm making something wrong?

推荐答案

如果你得到了同样的错误:安装TSC> = 1.8.0

If you get the same error: install tsc >=1.8.0

另外angular2-beta.7将有助于解决这一问题。但是要小心:ES6-承诺,rxjs有更新以及

Also angular2-beta.7 will help to solve the problem. But be carefull: es6-promise and rxjs has to updated as well.

这篇关于意外的管道值上组件的视图“未定义”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆