Regular: Rails + Angular
- CoffeeScript for code, because it looks good.
- Bower for managing frontend libraries, because it's simple.
- angularjs-rails-resource, because why not use it?
By using this gem, you will
- Be able to use Angular + Rails
- Adopt a convention about your Angular directory structure and
- Get some basic, but handy generators!
- Delegate Angular/frontend library management to Bower
- Still live in Ruby land (i.e. you can do E2E testing using Capybara)
You are invited to read this blog post for background information on this mindset (CARB).
Make sure you have bower installed. Then add this to your Gemfile:
bundle on the command-line and setup your angular project:
# Set up a new .bowerrc file and bower.json file rails g rg:bower # Use bower to install latest angulars bower install angular angularjs-rails-resource --save # Set up the angular app directory and add to sprocket manifest rails g rg:install --manifests=application.js
Alternatively, you can run all the previous commands via rake:
This gem does not mandate how you should organize your views. Don't forget to:
- include the
ng-appdirective in your HTML
- turn off turbolinks (remove from manifest file, HTML, Gemfile)
You have the following generators to create new Angular files for you:
The generators only generate very basic file content. While this is intended, there might be --options for power users in the future.
This gem is not finished, yet. Feel free to contribute:
- Turbolink support
- Add scaffold generator
- Add serializer generator + directory
- Add capabilities to rg:app to optionally create routing
- Generate JS Tests
(c) 2013 Jan Lelis