Reputation: 4022
Is Knockout JS only suitable for building single page web applications? I haven't been able to find any examples where it's used in a multi-page web application (for example, could you build something like stackoverflow.com using Knockout?).
Upvotes: 4
Views: 560
Reputation: 19718
This might look like a broad question, but the answer to it can be quite short: No, Knockout.js is not only for single page apps. Knockout.js is a templating library providing you with tools to create dynamic views using the MVVM pattern.
There's no restriction whatsoever on whether you want to use Knockout for a single page app or a multiple page website. Note that in the latter, the Knockout context won't be shared between pages.
Upvotes: 4
Reputation: 2396
Well that is a very wide question, but I myself am currently in progress of one portal which is based on knockout.js. Well not all of it - it has a MVC3 backend which then communicates with even another backend based on WCF services. So, no, knockout.js isn't the only technology there :)
Yet, databinding proves iself over and over again as a comfortable and useful approach to data-centric portal creation. There would have been problems in the earlier versions of knockout, which didn't support model value peek'ing, etc. But now it is all ok.
Each of our scope, one could say, is a one page app, with it's own model and elements. Though there are some common components for request long-polling, etc. Which tend to modify model values. Thus we no longer need to base on such week references like css classes for updating such information like activity counts. We rather update the model and let everything else take care for itself.
So, in short yes: with the right mix of other good technology, you can make big, multi page websites.
Upvotes: 2
Reputation: 50728
You can use Knockout for whatever type of application you want. I've used it in my MVC projects with no problems, and they weren't the single page app template. I know Microsoft included Knockout with single page apps project template by default, but you can also use it elsewhere, with no problems.
Upvotes: 0