Skip to content

Modifying an Existing Route

Joshua Nussbaum edited this page Feb 9, 2015 · 1 revision

Define a route

Edit your app/assets/javascripts/sprangular/extraRoutes.coffee and add the route you want to override. For example:

angular.module('MyApp').config ($routeProvider) ->

  $routeProvider
    .when '/products',
      controller: 'MyProductsCtrl',
      templateUrl: 'products/index.html'

Define a controller

# in app/assets/sprangular/controllers/myProducts.coffee
angular.module('MyApp').controller 'MyProductsCtrl', ($scope) ->
  # add whatever you need here

Clone this wiki locally