Created
May 24, 2014 05:54
-
-
Save uguisu-an/dcb4644a8f74f41c4d5f to your computer and use it in GitHub Desktop.
rails template for angularjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'angularjs-rails' | |
| run_bundle | |
| inside 'config/environments' do | |
| gsub_file 'production.rb', | |
| /config.assets.js_compressor = :uglifier/, | |
| "config.assets.js_compressor = Uglifier.new(mangle: false)" | |
| end | |
| inside 'app/assets/javascripts' do | |
| insert_into_file 'application.js', <<-CODE, before: "//= require_tree ." | |
| //= require angular | |
| //= require angular-resource | |
| //= require angular_app | |
| CODE | |
| file 'angular_app.js.coffee', <<-CODE | |
| @angularApp = angular.module('angularApp', ['ngResource']) | |
| @angularApp.config ($httpProvider) -> | |
| authToken = $("meta[name=\\"csrf-token\\"]").attr("content") | |
| $httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken | |
| $(document).on 'page:load', -> | |
| $('[ng-app]').each -> | |
| module = $(this).attr('ng-app') | |
| angular.bootstrap(this, [module]) | |
| CODE | |
| file 'controllers/.keep' | |
| file 'directives/.keep' | |
| file 'services/.keep' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment