Using Links With Angular Js And Rails

Posted by Weston Ganger

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.

Article Topic:Software Development - Rails

Date:July 31, 2014

Recommended Posts