A few times I've ruffled a few features by making the statement that I am not a fan of KnockoutJS.
Let me start by clarifying a few things:
- I think the concept of KnockoutJS is a good one
- It's nothing against Steve Sanderson, to have come up with it in the first place is impressive
- This is my opinion and I will still recommend that others try it and form their own opinions.
Ok so on to backing up my statement and let me start by showing you why I am not a fan:
<button data-bind="click: registerClick, enable: !hasClickedTooManyTimes()">Click me</button>
Can't see it? I'll remove some of the 'guff':
data-bind="click: registerClick, enable: !hasClickedTooManyTimes()"
Right there, the
So ultimately what it comes down to is that I have an issue with the binding syntax that is used with KnockoutJS. Now I (think) understand why it is like this, KnockoutJS has a lot of relationships with the WPF/ Sliverlight binding idea (and MVVM obviously) so it makes sense to people coming from those backgrounds. Me, I'm not a WPF/ Silverlight developer, never have been (I did try my hand at WPF but just didn't get very far...).
Why does it bother me?
You may be asking yourself that if the problem I have is with the syntax and not concept then where's the real issue, heck it's only a small part of it.
This is smarts that I don't want my HTML to have.
The shift has seen us using HTML to describe the intention. Using the jQuery unobtrusive validation as an example we use the
This post has basically outlined my primary grievance with KnockoutJS. As stated, I don't have a problem with the concept of it, the idea of two-way binding is quite nice but what's required to achieve that is where the issue lies.