mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
parent
09730ba09f
commit
4c1da71d84
1 changed files with 2 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ import {Component, ContentChild} from '@angular/core';
|
|||
export class MyComponent {
|
||||
@ContentChild('someRef') ref: ElementRef|undefined = undefined;
|
||||
|
||||
someMethod() {
|
||||
someMethod(): void {
|
||||
if (this.ref) {
|
||||
this.ref.nativeElement;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ import {Component, contentChild} from '@angular/core';
|
|||
export class MyComponent {
|
||||
readonly ref = contentChild<ElementRef>('someRef');
|
||||
|
||||
someMethod() {
|
||||
someMethod(): void {
|
||||
const ref = this.ref();
|
||||
if (ref) {
|
||||
ref.nativeElement;
|
||||
|
|
|
|||
Loading…
Reference in a new issue