What javascript framework would you use to build a multi-page Rails app?

I am building a multi-page rails web app and am struggling with finding a good JavaScript framework to use. I could use jQuery for all the low-level DOM manipulations but would like to benefit from the structure of a good framework.

I am new to Rails/JavaScript and most of what I have seen (Backbone/Ember/Angular) are really designed for Single Page Applications and you will have to hack your way in to build a multi page web app (or at least that is what I infer). I am looking for something that just works out of the box without too much tinkering.

Any pointers are appreciated.

Try ext.js! it looks awesome

The term “single page app” is a misnomer in my opinion, because as you use “single page app” you see many pages. “Single page” just means it loads once in a single web server call, and then all subsequent interactions manipulate parts of the DOM and talk to an API on the back -end without reloading the page.

You don’t have to “hack your way” to build an app that you can click from page-to-page, you just have to know how to use the framework correctly.

If you use Backbone, check out http://marionettejs.com alongside it.

Angular and Ember are both relatively new (< 2 years old), and AFAIK there’s a lot of active development going on. If you want to be on the bleeding edge and don’t mind a steep learning curve, they are both worth learning.

If you perhaps don’t want to be on the bleeding edge and want to stick with Rails, perhaps now isn’t the right time to learn Ember or Angular.

Backbone, while very powerful, requires more coding and without Marionette you have to wire up a lot of UI updates manually (Ember and Angular take a more declarative approach and you have to do less manual UI updating). Marionette eliminates some of that, but you still have a lot of code to write and test.

I would classify all three as for experienced Javascript developers and wouldn’t recommend any of them unless you had a solid foundation in the nuances and inner working of advanced Javascript (like scoping, event bubbling, and promises).

I wrote this blog entry a while ago and it needs some work and fine tuning.

http://maxwellhoffmanfamily.com/wordpress/?p=73

that being said, it walks someone through a pattern for using angularjs in a rails app. It isn’t using the angular router, but it does give you the ability to easily leverage some of the great features of angular in a rails application.

We have been using angularjs in rails apps for a couple years now and like it a lot. I hear a lot of great things about ember, when we chose it was a coin flip. I don’t have experience with ember so i can’t compare personally but angular works great for us.

HTH

max

I’m working my way through this rails-ember tutorial which you might find helpful:

http://ember.vicramon.com/

I was really confused in Ember tutorials early on until I understood the difference in meanings of certain similar “terms” used by both Ember and Rails. This helps:

Also this is a good comparison on the differences between Ember and Angular, so you can choose which might fit your needs better.

http://www.benlesh.com/2014/04/embular-part-1-comparing-ember-and.html

Hope these are useful.

​Angular frontend + Rails API get works best IMO. Am working on a couple of sites using this stack and the UI dev swears by Angular.

Thanks, Ganesh​