Knockout JS mapping plugin without initial data / empty form

A couple of options for you besides just manually managing your view model. The mapping plugin supports a create callback that lets you customize how it gets created. This can be used to add default properties to an object, if they happen to be missing. Something like this: http://jsfiddle.net/rniemeyer/WQGVC/ Another alternative is to use a … Read more

How do I correctly detect orientation change using Phonegap on iOS?

This is what I do: function doOnOrientationChange() { switch(window.orientation) { case -90: case 90: alert(‘landscape’); break; default: alert(‘portrait’); break; } } window.addEventListener(‘orientationchange’, doOnOrientationChange); // Initial execution if needed doOnOrientationChange(); Update May 2019: window.orientation is a deprecated feature and not supported by most browsers according to MDN. The orientationchange event is associated with window.orientation and therefore … Read more