加载bing指示模块Angular

时间:2017-11-22 15:14:54

标签: javascript angular bing-maps

使用bing贴图,此刻我可以创建地图添加针脚和更新针脚

我现在要做的是创建/更新路由,但loadModule函数不会触发

  Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function() {
        //Create an instance of the directions manager.
        this.directionsManager = new Microsoft.Maps.Directions.DirectionsManager(this.map);

        console.log(this.directionsManager)//This doesn't show

        //Set the request options that uses kilometers.
        this.directionsManager.setRequestOptions({
          distanceUnit: Microsoft.Maps.Directions.DistanceUnit.km
        });
        //Make the route line thick and green.
        this.directionsManager.setRenderOptions({
          drivingPolylineOptions: {
            strokeColor: 'green',
            strokeThickness: 6
          }
        });

      });

正如我所说,我可以做一些事情;

this.map = new Microsoft.Maps.Map(...)

this.user = new Microsoft.Maps.Pushpin(...)

1 个答案:

答案 0 :(得分:0)

问题是我必须改变

 Microsoft.Maps.loadModule(..) 

 Microsoft.Maps.Module.loadModule(...)