Search code examples
javascriptangularjsangularjs-directivemodulebing-api

Microsoft.Maps.loadModule with Angularjs


I am using Microsoft.Maps.loadModule in a directive for AutoSuggest functionality. Problem is that script is loading async and my directive trigger before script is loaded... Can you provide me with some solutions on how to trigger Microsoft.Maps.loadModule function inside directive after script is loaded, or if there is some other solution I would really appreciate it.

Cheers!


Solution

  • you can use a call back function to trigger after bingmap loaded.

    $.getScript("http://www.bing.com/api/maps/mapcontrol?branch=release&callback=bingMapLoaded");
    
    function bingMapLoaded(){
      alert('my bing map loaded');
    }