While these posts may be full of opinions, they will be as truthful as possible and relevant to the point.
Test 1 – Data-binding
What do I expect from my two-way data-binding?
- Data is bound from the view to the * (controller, viewmodel, w/e)
- Binding is as efficient as possible (don’t waste my resources)
- Context / Scope is easy to understand
- Easy to use for a developer – the end-user doesn’t care how well data-binding occurs…
- Data is bound to the view model.
- Binding occurs on blur, unless specificied
- Context is easy to set (with or foreach bindings give nested context easily)
- A dynamic nesting tree of data-binds is available, and trouble-shooting info is always available in console
- Bindings can easily break when not handled properly (ie. binding to ID before it is available)
- Must use an additional data-bind attribute ‘valueUpdate: onKeyPress’ for per-key updates or use a custom binding handler
- Must understand $parent, $parents, and $root for contextual purposes
- Often a simple parans can be the difference between bindings working and two hours of work for a new developer
- Binding is simple and doesn’t require understanding of getters and setters
- Binding is on key press by default
- Settings what is within $scope is more explicit in the controller
- Binding requires no parans(!!!)
Cons – (at least 1 week into a project)
- Notification of broken binds is not apparent
- Refactoring every binding in the view occurs every key stroke
- Contextual bindings aren’t as clear
- Bindings require twice as much mark-up (ng-click, ng-model, etc…)
In closing, Knockout serves a singular purpose (data-binding, rich UI’s) that can easily replace many of the functions that we as interface developers have relied upon jQuery for in the past. Angular takes on many more tasks in addition to data-binding and therefore seems to have a very sufficient ability to bind data while taking it’s own approach.
Overall winner : Knockout
Knockout knows what it’s main purpose is – data-binding and creating a rich UX. Angular is good at both but seems to lean towards an all or nothing mentality, and does not support many dev favorites –
- Doesn’t support Knockout
- Doesn’t (easily) support Twitter Bootstrap