title: Configuring AngularJS Routes on Rails
body: <p>I'm having a difficult time configuring AngularJS Routes on Rails. I know that this is a basic concept and have read: <a href="http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/" rel="nofollow">http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/</a>, but it seems I am still a bit confused. </p>
  
  <p>I currently have a Rails routes.rb file that I would like to set up to process angularRoutes first and if its not an angular route, then fall back to rails. The link above says to include the follow 2 lines of code:</p>
  
  <pre><code> root 'application#index'
   get '*path' =&gt; 'application#index'
  </code></pre>
  
  <p>which will thus direct the root page to the application controller's index method. In that case, I am not quite sure how Angular gets a chance to do its routing.</p>
  
  <p>I am unsure what to put inside my routes.rb file for my Rails Project so that Angular routes would execute first.</p>
  
  <p>My angular routes: </p>
  
  <pre><code># Define the carmel application
  @carmel = angular.module('carmel',
      'ui.bootstrap',
      'ngRoute',
      'templates',
  ])
  
  # Define our routes
   @carmel.config([
     '$routeProvider',
     '$locationProvider',
     ($routeProvider, $locationProvider) -&gt;
  
      console.log("HEre1");
  
      $routeProvider.when '/',
          templateUrl: '&lt;%= asset_path("production/index.html") %&gt;'
          controller:  'ProductionIndexCtrl'
          resolve: {
  
          }
  
      # So we don't have "#" in the url's.  Magic.
      $locationProvider.html5Mode true
  ])
  </code></pre>
  
  <p>(I would like the root path to direct to my angular templateURL and controller, currently I am getting an error.)</p>
  
  <p>ActionView::MissingTemplate at /</p>
  
  <p>Missing template application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee, :haml]}. Searched in: * "/Users/simon_zhu/Documents/carmel/app/views" * "/Users/simon_zhu/.rvm/gems/ruby-2.1.0/gems/jasmine-rails-0.9.0/app/views" * "/Users/simon_zhu/.rvm/gems/ruby-2.1.0/gems/devise-3.2.4/app/views"</p>