0

I have a link on my page that has an id parameter (123) as listed below:

ng-click="setRoute('user/123/view')"

I am unable to get the $routeProvider below to work:

$routeProvider.when('/user/:id/view', {
    templateUrl: 'partials/user/nav.html',
    controller: 'UserCtrl'
});

What am I missing? I have gotten similar code to work, but when I don't have a parameter. What is it about the parameter that I am doing incorrectly?

6
  • No errors in the console? does the template load does a debug point hit in your UserCtrl Jul 5, 2013 at 4:32
  • What does the link look like?
    – frosty
    Jul 5, 2013 at 5:46
  • The link is triggered by ng-click. Jul 5, 2013 at 6:27
  • what does setRoute() do? This is not an angular function, so the error might be there.
    – Narretz
    Jul 5, 2013 at 8:11
  • This is what I have for setRoute(). The scope of the controller is in the body tag: function MainCtrl($scope,$location){ $scope.setRoute = function(route){ $location.path(route); }; } Jul 5, 2013 at 16:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.