Using Links With Angular Js And Rails

Posted By Weston Ganger

<p>Using Angular Routing we need some configuration for links:</p>
<p> </p>
<p>First we must turn html5mode on for angular by adding the following to your apps config:</p>

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

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

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

<p>Now you can format your links just like you normally would.</p>

Article Topic:Software Development - Ruby / Rails

Date:July 31, 2014