I am looking for a way to control large amounts of JavaScript code in a ASP.Net MVC web application.
I have been looking at Ember.js and whilst it’s pretty compelling it takes control of the routing and as such treats the server as little more than a place from which to receive API calls. This isn’t really useful for what I need.
I wondered if there recommendations for similar projects out there that allow faster, more structured, JavaScript but in traditional server-based web applications?
Take a look at knockout.js it is an MVVM library.Like most frameworks it does not have any routing.Rather it has a concept of observables.What this means is it can observe any DOM elements for changes and once detected it updates the UI automatically.This can take care of most of the DOM interaction that we do in single page applications like showing/hiding certain parts of UI based on user actions.
For me knockout.js has the cleanest syntax in javascript frameworks.All the bindings are done through html 5 data* attributes.
You might also want to check out this excellent article that compares the most popular javascript mvc frameworks.If you already have written lots of client side code and are considering migrating to knockout.js check out this question that I asked on stack overflow.The answer really helped me in finding an effective way to do this.
3
There are a whole bunch of various JavaScript frameworks.
You can find exemples of applications in there:
http://todomvc.com/
And a nice comparison here:
http://coding.smashingmagazine.com/2012/07/27/journey-through-the-javascript-mvc-jungle/
I personnally like Angular as it’s more powerful then Knockout and lighter than Ember.
1
You can disable Ember’s URL management. Read the guide http://emberjs.com/guides/configuring-ember/embedding-applications/ before you discard Ember. What’s considered a structured web application on client-side is moving forward in a rapid and pleasant manner (i.e. Ember). That fact does also make Niphra’s suggested article from Smashing Magazine outdated if you are evaluating Ember.
But Ember might still not be way to go for structuring large amounts of existing JavaScript code. Someone else might fill in on that subject.