Search code examples
angularjsangularjs-routing

Angular routing was ignored


I have module Board with routes:

@Board.config ($routeProvider, $httpProvider,$locationProvider)->
  # Code
  $routeProvider
  .when '/boards/:board_id/topics/new', {
    templateUrl: (p) -> "/boards/#{p.board_id}/topics/new"
    controller: 'TopicsNewCtrl'
  }
  .when '/boards/:board_id', {
    templateUrl: (p) -> "/boards/#{p.board_id}"
    controller: 'BoardsShowCtrl'
  }
  .when '/boards', {
    templateUrl: "/boards"
    controller: 'BoardsShowCtrl'
  }

When I go to /boards/common, controller BoardShowCtrl executed correctly, but when I go to /boards/common/topics/new request goes directly to my Rails backend instead of angular routing. Here is my controller:

@Board.controller 'TopicsNewCtrl', [
  "$scope"
  "$routeParams"
  "$http"
  "topicsFctr"
  ($scope, $routeParams, $http, topicsFctr) ->
    $scope.board_id = $routeParams.board_id
]

I can't find an error in my code, it works with other controllers and templates. If you need some additional data - just ask.

Thank you for your answers!

P.S. Sorry for my English. It is so bad, I know :)


Solution

  • Resolved! There was another module with routing, matches my urls. It was so simple... and so stupid.