【发布时间】:2017-07-30 03:05:12
【问题描述】:
我正在挠头,试图弄清楚将 bing map api 集成到 angularjs 1.6.4 。任何人都可以帮助...?。
这是我的html
https://www.bing.com/api/maps/mapcontrol?callback=loadMapScenario' async defer>
以下代码在 Body 标签内。
我的角度控制器代码如下
$scope.map = null;
function loadMapScenario() {
console.log('Load scenario called');
var map = new Microsoft.Maps.Map(document.getElementById('mapDiv'), {
credentials: 'Ao-Rs8NHwtlEI5piXQCcxMZrTfAt9zbg7a-8hB4PLAcc0eo5nZPN84aY16noJGKS',
center: new Microsoft.Maps.Location(41.264675, -96.041927),
zoom: 4
});
}
//$scope.map = null;
$scope.init = function () {
console.log('Map init');
$scope.map = new Microsoft.Maps.Map(document.getElementById('mapDiv'), {
credentials: 'api Key',
center: new Microsoft.Maps.Location(41.264675, -96.041927),
zoom: 4
});
};
angular.element(document).ready(function () {
$scope.init();
});
问题:
我收到以下错误
Uncaught ReferenceError: Microsoft is not defined
和
未捕获的 TypeError: window[Microsoft.Maps.CallbackOnLoad] 不是函数
知道这段代码有什么问题吗?
感谢您的帮助
【问题讨论】:
标签: jquery angularjs callback bing-api