Mapbox-gl.js map is undefined in angular-cli project on load event
问题 Started an angular-cli project and installed mapbox-gl via npm. Included the mapbox-gl script and styles in the angular-cli.json file. I can get the map to show, but I cannot add a layer on the load event. The map is undefined suddenly? Here is the template html (app.component.html): <div id="map" style="margin:0; padding:0; position:absolute; top:25px; bottom:0; width:100%;"> </div> And here is my component code (app.component.ts): import { Component, ViewChild, AfterViewInit, OnInit } from