Angular2无法使用exportAs绑定组件

时间:2016-09-08 06:13:48

标签: angular typescript

我有以下代码(Angular2 rc.5):

app.html

<div>
  <myComp #compo-binding="my-comp" *ngIf="someCondition"></myComp>
  {{ compo-binding.test }}
</div>

myComp的html被正确注入,但compo-binding.test生成错误,表示测试在undefined上不存在

myComp.component.ts

import { Component } from "@angular/core"

@Component({
    selector: "myComp",
    exportAs: "my-comp",
    templateUrl: "./myComp.html"
})
export class MyComp{
    test: boolean = true
}

知道我对exportAs做错了什么吗?

0 个答案:

没有答案