Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
Angular can be used both with custom attributes or data-... attributes: github.com/angular/angular.js/blob/master/CHANGELOG.md#1.0.0rc1 –  Niphra Apr 26 '13 at 13:09
    
Ahh that's nice I did not know that. –  Akshat Jiwan Sharma Apr 26 '13 at 13:32
1  
Excellent answer, exactly what I was looking for. Cheers! –  Damien Apr 27 '13 at 10:35
add comment

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.

share|improve this answer
    
Doesn't Angular want to take control of routing though? –  Damien Apr 29 '13 at 20:13
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.