Skip to content

Instantly share code, notes, and snippets.

@adrianpietka
Last active November 1, 2017 11:28
Show Gist options
  • Select an option

  • Save adrianpietka/57ec031c71c01ce241c6fa1d837c6dd7 to your computer and use it in GitHub Desktop.

Select an option

Save adrianpietka/57ec031c71c01ce241c6fa1d837c6dd7 to your computer and use it in GitHub Desktop.
AngularJS 1.x & Bing Maps V8 Web Control
(function () {
var mapTimer = setInterval(mapSupervisor, 10);
function mapModule(angular, Microsoft) {
angular
.module('app')
.factory('mapProxyService', mapProxyService);
console.log('Has all modules. Initialize.');
function mapProxyService() {
console.log('Microsoft:', Microsoft);
return {
map: Microsoft.Maps
}
}
}
function mapSupervisor() {
var isLoadedMap = window.Microsoft !== undefined
&& window.Microsoft.Maps !== undefined
&& window.Microsoft.Maps.Events !== undefined
&& window.Microsoft.Maps.Layer !== undefined;
if (isLoadedMap) {
clearInterval(mapTimer);
mapModule(window.angular, window.Microsoft);
} else {
console.log('Waiting...');
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment