I'm using Durandal/Hot Towel SPA with Bing Maps library described here http://soulsolutions.com.au/Blog/tabid/73/EntryId/818/Knockout-JS-and-Bing-Maps.aspx. This library creates custom ko binding to access map control.
With durandal this binding works only in one way. It is possible to get value (for example zoom level) from map control after change but when I want to set zoom level after click it's not working.
Outside Durandal when I was testing it on a simple html page everything was ok.
Any idea what's wrong? Any help would be greatly appreciated.
My viewmodel:
var mapVM = function () {
this.map = {
options: {
credentials: "bing key",
customizeOverlays: true,
showScalebar: false,
showMapTypeSelector: false,
enableClickableLogo: false,
enableSearchLogo: false,
},
mapview: {
zoom: ko.observable(4).extend({ throttle: 1 }),
},
};
this.testZoom = function () {
this.map.mapview.zoom(5);
};
};
view:
<input data-bind='value: map.mapview.zoom, valueUpdate: "afterkeydown"' />
<input type="button" data-bind="click: testZoom" value="test zoom" />
<div id="mapControl" data-bind="bingmaps: { map: map }" style="position: relative; width: auto; height: 400px">