Rails

Using Links With Angular Js And Rails

Posted by Weston Ganger on July 31, 2014

Using Angular Routing we need some configuration for links:

 

First we must turn html5mode on for angular by adding the following to your apps config:


app.config(['$locationProvider', function($locationProvider){
  $locationProvider.html5Mode(true);
});

Add the following catch all route to the end of config/routes.rb:

get "*path", to: "youController/index"

Now you can format your links just like you normally would.


Posted in Rails and Tagged with rails angular angularjs 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts