我有一个自定义的角度分量:
@Component({
selector: 'my-sel',
template: `<div #myRef></div>`,
styleUrls: ['...']
})
export class MyComponent {
@ViewChild('myRef') public myRef: ElementRef;
// other stuff goes here...
}
现在,当我在另一个组件模板中两次使用<my-sel></my-sel>
时,我想分别引用myRef
变量。
我没有找到解决方法。无处。 如何做到这一点?