【发布时间】:2017-02-21 09:25:30
【问题描述】:
我正在尝试将我的 Bing Maps v7 升级到 v8,根据文档,我应该能够交换 url,它可以解决可能的小问题。
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src='https://www.bing.com/api/maps/mapcontrol?branch=release'></script>
<body ng-app="myApp">
<div ng-controller="bingCtrl" ng-init="init()" ng-cloak>
<div id="mapDiv"></div>
</div>
<script>
var app = angular.module("myApp", []);
app.controller("bingCtrl", function($scope) {
$scope.map = null;
$scope.init = function() {
$scope.map = new Microsoft.Maps.Map(document.getElementById('mapDiv'));
};
});
</script>
</body>
</html>
我删除了所有代码以查看是否可以隔离问题,并且可以使用上面的代码。我收到以下错误。任何想法为什么这不起作用?
TypeError: 无法读取 null 的属性“原型”
【问题讨论】: