小编Gre*_*egL的帖子

Object.toString和Object.prototype.toString之间有所不同

我们可以Object.prototype.toString.call(foo)用来检测对象类(foo的类型),它运行良好.

但为什么Object.toString.call({})TypeError: Function.prototype.toString is not generic

Object.toString继承Object.prototype吗?

javascript

8
推荐指数
1
解决办法
681
查看次数

用于谷歌地图的Angular 2 agm库按地点ID设置

我正在一个页面中实现一个谷歌地图,其中一个地方ID传递给我,然后我需要获得这样的地方ID并加载该标记的地图.我正在浏览文档,但不清楚如何从<agm-map>标记中定位地图对象,以便我可以设置地点ID.以下是代码的一部分:

  public latitude: number;
  public longitude: number;
  public zoom: number;
  public placeid: string;

  constructor(
    private mapsAPILoader: MapsAPILoader,
    private ngZone: NgZone
  ) {}

  ngOnInit() {
      //set google maps defaults
      this.zoom = 4;
      this.latitude = 39.8282;
      this.longitude = -98.5795;
      this.placeid = "ChIJMS2FahDQzRIRcJqX_aUZCAQ";

      //set current position
      this.setCurrentPosition();

      this.mapsAPILoader.load().then(() => {
            //How do i set the agm-map here to load the map with the placeid

      });
    }

    private setCurrentPosition() {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition((position) => {
          this.latitude = position.coords.latitude;
          this.longitude …
Run Code Online (Sandbox Code Playgroud)

google-maps typescript angular2-google-maps angular

8
推荐指数
1
解决办法
6171
查看次数