Angular 意外的管道值';未定义';论构件观

Angular 意外的管道值';未定义';论构件观,angular,Angular,我经常看到“意外的指令值‘未定义’…”的问题,但“意外的管道值‘未定义’…”会出现不同的错误 首先,当我尝试将自定义@Directive注入到组件时,出现了这个错误。我还没有找到解决办法。但是我试着把管子从我的部件上取下来,它成功了 所以这是可行的: @Component({ selector: 'my-app', templateUrl: 'app/templates/app.component.html', pipes: [TranslatePipe], }) exp

我经常看到“意外的指令值‘未定义’…”的问题,但“意外的管道值‘未定义’…”会出现不同的错误

首先,当我尝试将自定义@Directive注入到组件时,出现了这个错误。我还没有找到解决办法。但是我试着把管子从我的部件上取下来,它成功了

所以这是可行的:

@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 {}

这是一个悬而未决的问题吗?我找到虫子了吗?或者它只是没有文档记录,而我犯了一些错误?

如果您遇到相同的错误:安装tsc>=1.8.0


另外,angular2 beta.7将有助于解决这个问题。但是要小心:es6 promise和rxjs也必须更新。

你能在plnkr上创建一个plunker repo吗?它可以工作:-/hm好的-当我运行
tsc
时,它编译一些不起作用的东西。当我运行
npm run tsc
时,它会因错误而中断,但应用程序可以工作。可能与缩小有关。存在已知问题。