【发布时间】:2017-12-29 15:59:30
【问题描述】:
我有如下自定义组件。我想获取我们在 html 文件中使用的组件的 ID。
@Directive({
selector: `[myattr]`
})
export class myclass
{
// want to get reference where myattr defined
//#myid
}
在 html 中我将定义如下
<input #myid myattr />
【问题讨论】:
标签: angular angular2-custom-component