Created
February 13, 2019 14:15
-
-
Save eugene-ilyin/d5c456eef79c5792509e4e7bcaca93d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, Directive, ElementRef, QueryList, ViewChildren} from "@angular/core"; | |
// DON'T FORGET TO DECLARE A DIRECTIVE IN YOUR MODULE. | |
// Selector by class | |
@Directive({selector: '.live-screen__user-microphone'}) | |
export class microphoneIconSelector { | |
// Define a property to make it available in object, returned by directive. | |
nativeElement: any; | |
constructor(private element: ElementRef) { | |
this.nativeElement = element.nativeElement; | |
} | |
} | |
@Component({ | |
selector: 'pr-component', | |
template: require('./component.component.html'), | |
}) | |
export class Component { | |
@ViewChildren(microphoneIconSelector) tooltipMicrophoneElems: QueryList<microphoneIconSelector>; | |
ngAfterViewInit() { | |
this.tooltipMicrophoneElems.forEach(item => { | |
// item.nativeElement is available for interactions | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment