The best lifecycle hook to use is AfterContentInit, which allows scripts to find all the html content (e.g. div #map_canvas ).
import { AfterContentInit, ViewChild } from '@angular/core';
In addition, some updates have been made for ViewChild, now it takes a second parameter:
@ViewChild('map_canvas', {static: false}) map_canvas: ElementRef;
Now you can use this hook to initialize your map:
ngAfterContentInit() { this.loadMap(); }
source share