当我试图在 angular 2 zone.js 中创建一个新的谷歌地图时,它给了我一个超出的最大调用堆栈。有人经历过吗?
地图组件:
import { Component, OnInit} from '@angular/core';
import { Map, MapOptions, LatLng} from '../../models/map.model';
@Component({
moduleId: module.id,
selector: 'map',
templateUrl: 'map.component.html',
styleUrls: ['map.component.css']
})
export class MapComponent implements OnInit {
private _map: Map;
private _mapOptions: MapOptions;
constructor() {
}
ngOnInit() {
this._mapOptions = new MapOptions();
this._mapOptions.center = new LatLng(35.9273232, 14.413077);
this._map = new Map(document.getElementById('googleMap'), this._mapOptions);
}
}