0
我试图在knockout.js foreach循环中显示Bing地图。但是我收到一条错误消息“TypeError:ft is null”。Bing地图和knockout.js
但是,如果我不包括knockout.js,那么它工作正常。
但我需要在我的项目中使用knockout.js的foreach循环。
任何帮助将不胜感激。
我的HTML文件: -
<div class="container contact-body-contents" data-bind="foreach: addresses">
<p class="text-bold-head" data-bind="text: location"></p>
<span data-bind="html: address"></span>
<span data-bind="text: phone"></span>
<div id='myMap' style="position:relative; width:400px; height:400px;float: "right">
</div>
</div>
map.js
var map = null;
function GetMap()
{
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("myMap"),
{credentials:"credentials"});
// Define the pushpin location
var loc = new Microsoft.Maps.Location(41.806358,-73.112144);
// Add a pin to the map
var pin = new Microsoft.Maps.Pushpin(loc);
map.entities.push(pin);
// Center the map on the location
map.setView({center: loc, zoom: 15});
}
请张贴您的代码的一些帮助。你想做什么的想法是好的。 –
问题不在于你显示的代码部分。尝试创建一个最小化的测试用例来重现问题并发布。 – ebohlman