How can I use steve's Knockout-ES5-Plugin (http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/) with Breeze and Durandaljs?
Thanks a lot!
How can I use steve's Knockout-ES5-Plugin (http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/) with Breeze and Durandaljs?
Thanks a lot!
On
For Durandal, you can hook into the view model binder's beforeBind hook to automatically have Steve's plugin convert your object just before it is bound. This may not work flawlessly, I haven't tried it myself. Also, bear in mind that his plugin does not convert full object graphs, only the basic properties on the object. So, binding in this way probably won't work 100% as you want.
Durandal 2.0 has it's own ES5 plugin that works correctly :) It's not released yet, but it's under source along with the rest of 2.0 if you want to live on the edge. Release is scheduled for mid August.
Regarding Breeze, I'm not sure.
The selected answer to this post takes the approach of:
ko.track(entity._backingStore)when a user indicates they want to edit a record.This has the advantage of being much lighter for long lists of entities by not making them observable until they need to be. The ES5 plugin adds the benefit that the bindings in HTML don't need to change between the non-observable entities and the observable ones (as the brackets are not required).
If you required all entities to be "ES5" observable by default then you'd probably be best to write a custom modelLibrary adapter - take a look in the Breeze debug file (or source) to see the three built in adapters:
backingStore,backbone, andkoas examples.