Skip to content

Instantly share code, notes, and snippets.

@trungv0
Last active August 29, 2015 14:21
Show Gist options
  • Save trungv0/420334f4217932bc4ea2 to your computer and use it in GitHub Desktop.
Save trungv0/420334f4217932bc4ea2 to your computer and use it in GitHub Desktop.
angular in rails
# config/initializers/angular_assets.rb
Rails.application.assets.register_engine('.haml', Tilt::HamlTemplate)
# app/assets/javascripts/app.coffee.erb
#= depend_on_asset "templates/view.html"
...
module.config ($routeProvider, $locationProvider) ->
$routeProvider.when '/books',
templateUrl: '<%= asset_path "templates/books.html" %>',
controller: 'BooksController'
// app/assets/javascripts/application.js
//= require angular
//= require angular-resource
//= require angular-route
gem 'angularjs-rails'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment