Но ... это ломает эпоху, и это не то, как Angular должен быть загружен. Итак, вернемся к доске.
ал в Google иstackoverflow
, но не смог найтиsolution
для этого вопроса. Я загружаюmap
вот так по моемуview
.
<img
ng-src='https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/
{{Latitude.__text}},{{Longitude.__text}}/12?mapSize=77,120&
key={{Key}}'></img>
Ниже показано, как его загрузить в index.html.
<script type='text/javascript' src='https://www.bing.com/mapspreview/sdkrelease/mapcontrol?callback=loadMapScenario' async defer></script>
<script type='text/javascript' src='app/services/bing.js?' async defer></script>
Ниже мойcontroller
код, где я пытаюсь позвонитьmaps
.
function GetMap() {
if (typeof Microsoft !== undefined && typeof Microsoft.Maps !== undefined &&
Microsoft.Maps.Map !== null) {
//Map API available add your map load code.
angular.element(document).ready(function() {
map = new Microsoft.Maps.Map(document.getElementById('myMapL'), {
credentials: Key,
mapTypeId: "r",
zoom: 4
});
});
} else {
setTimeout(GetMap(), 100);
}
}
Я получаю следующую ошибку:
TypeError: Cannot read property 'prototype' of null
at k (bing.js:11)
at h (bing.js:11)
at e (bing.js:11)
at t.l [as instance] (bing.js:11)
at h (bing.js:11)
at e (bing.js:11)
at t.l [as instance] (bing.js:11)
at new Microsoft.Maps.Map (bing.js:13)
at HTMLDocument.<anonymous> (file-location.js:121)
at j (jquery-1.11.0.min.js:2)