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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts