Setting the map as a variable in angular6/openlayers
问题 I use angular 6 and openlayers 5.1.3. I did npm install ol --save successfully and then in my angular I did import OlMap from 'ol/map'; import OlXYZ from 'ol/source/xyz'; import OlTileLayer from 'ol/layer/tile'; import OlView from 'ol/View'; import * as OlProj from 'ol/proj'; import 'ol/ol.css'; export class myComponent { olmap: OlMap; source: OlXYZ; layer: OlTileLayer; view: OlView; //other, non-ol stuff loading: boolean = false; myname: String; ngOnInit() { this.source = new OlXYZ({ url: