Skip to content

Commit ccbe51e

Browse files
AlexElinmmalerba
authored andcommitted
docs: pass ElementRef<HTMLElement> as is into FocusMonitor methods (#21906)
`FocusMonitor`'s `monitor`/`stopMonitoring` accepts `ElementRef<HTMLElement>`. So there's no need to call `ElementRef.nativeElement` https://material.angular.io/cdk/a11y/api#FocusMonitor (cherry picked from commit 176a91f)
1 parent 47ecf53 commit ccbe51e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/creating-a-custom-form-field-control.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@ focused = false;
235235

236236
constructor(fb: FormBuilder, private fm: FocusMonitor, private elRef: ElementRef<HTMLElement>) {
237237
...
238-
fm.monitor(elRef.nativeElement, true).subscribe(origin => {
238+
fm.monitor(elRef, true).subscribe(origin => {
239239
this.focused = !!origin;
240240
this.stateChanges.next();
241241
});
242242
}
243243

244244
ngOnDestroy() {
245245
...
246-
this.fm.stopMonitoring(this.elRef.nativeElement);
246+
this.fm.stopMonitoring(this.elRef);
247247
}
248248
```
249249

0 commit comments

Comments
 (0)