AfterViewInit

So, why are we using AfterViewInit interface, and the ViewChild decorator?

We need access to the component DOM view and its children.

from the angular docs about lifecycle hooks:
ngAfterViewInit() is called once after Angular initializes the component's views and child views / the view that a directive is in.

we use @ViewChild('mapElement') mapElm: ElementRef;
to let angular know that we are looking for a native DOM element.

then we hook it to ngAfterViewInit() where the view children have been created.