Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
import {
AfterViewInit,
ChangeDetectorRef,
Component,
ElementRef,
NgZone,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';

Expand All @@ -15,7 +15,7 @@ import {
templateUrl: 'focus-monitor-focus-via-example.html',
styleUrls: ['focus-monitor-focus-via-example.css']
})
export class FocusMonitorFocusViaExample implements OnDestroy, OnInit {
export class FocusMonitorFocusViaExample implements OnDestroy, AfterViewInit {
@ViewChild('monitored') monitoredEl: ElementRef<HTMLElement>;

origin = this.formatOrigin(null);
Expand All @@ -24,7 +24,7 @@ export class FocusMonitorFocusViaExample implements OnDestroy, OnInit {
private cdr: ChangeDetectorRef,
private ngZone: NgZone) {}

ngOnInit() {
ngAfterViewInit() {
this.focusMonitor.monitor(this.monitoredEl)
.subscribe(origin => this.ngZone.run(() => {
this.origin = this.formatOrigin(origin);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
import {
AfterViewInit,
ChangeDetectorRef,
Component,
ElementRef,
NgZone,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';

Expand All @@ -15,7 +15,7 @@ import {
templateUrl: 'focus-monitor-overview-example.html',
styleUrls: ['focus-monitor-overview-example.css']
})
export class FocusMonitorOverviewExample implements OnDestroy, OnInit {
export class FocusMonitorOverviewExample implements OnDestroy, AfterViewInit {
@ViewChild('element') element: ElementRef<HTMLElement>;
@ViewChild('subtree') subtree: ElementRef<HTMLElement>;

Expand All @@ -26,7 +26,7 @@ export class FocusMonitorOverviewExample implements OnDestroy, OnInit {
private cdr: ChangeDetectorRef,
private ngZone: NgZone) {}

ngOnInit() {
ngAfterViewInit() {
this.focusMonitor.monitor(this.element)
.subscribe(origin => this.ngZone.run(() => {
this.elementOrigin = this.formatOrigin(origin);
Expand Down