Hacker News new | ask | show | jobs
by stackthatcode 4216 days ago
I really like KnockoutJS, having used it on multiple projects, both personal and professional. Many will say that it can't really be apples-to-apples compared with Angular since it's technically MVVM, it lacks many of Angular's features, like dependency injection etc. etc. And that's all true. But, the end result for me is that I'm able to rapidly build sophisticated client apps. I'd have to dig up the links, but there are some pretty complex front-end apps i.e. website builders and the like, that were developed using KnockoutJS.
5 comments

I second this.

On a previous project for our company, another dev and I were able to research and decide whether to use Angular or Knockout for a specific project. We concluded that for us, Knockout was the better choice because it seemed lighter-weight in terms of actually achieving our end goal which was simply doing reactive data-binding on the client side rather than having to do so with jQuery manually. We've since used it to create some pretty awesome user experiences that would have been a pain manually. To us, it didn't seem Angular would have been a poor choice. Rather, it was just that our goal was such that we did not need everything that Angular offers.

I concur, Knockout is awesome despite being un-hyped. Small, stable, reliable, compatible with IE6+.

If you want a modern ES5 alternative there's also Vue.js

Do you do databinding? I like KnockoutJS too, but to me it is purely limited to making a page more interactive, not much with back-end integration.
Knockout doesn't have built-ins to wire up UI actions automatically to CRUD calls, but the portion of that you end up having to implement is usually extremely small.

As far a wiring up objects to knockout observables you have two options:

1) use the mapping plugin. I tend to stay away from this, as it makes everything on objects observable. Not bad per-se, but I like more control.

2) define your own model...its easy: https://gist.github.com/jdc0589/c48c2355302390ad954b

My team does data-binding with it via its mapping plugin. It's very powerful to use if you're working with json data to/from your server.
I just saw a demo of Knockout 3 and it looked much better than the older versions. That said I still like React and think Angular works great too.
KnockoutJS is great. It's small, simple, stable, it works on every browser, even IE6 and mixing it in with other technologies is no problem. Being able to easily read through the entire code of KnockoutJS is another big plus. I've used this on a few big projects so far and it's just a pleasure to work with.