Pipeline
Pipeline

Reputation: 1059

Angular $routeparams empty using $stateprovider

I am trying to have a link in my page such as:

 <a ng-href="#/Page/{{x.ID}}">{{x.ID}}</a>

Which succesfully gets to the angular controller but however the $routeparams are null when I am expecting to get the {{ x.ID }} back:

pageController.js

 angular.module("myApp.Pages").controller("pageController", ['$scope', '$http', '$routeParams', function ($scope, $http, $routeParams) {
    console.log($routeParams);

}]);

And am referencing the state in my $stateprovider such as (in appRouting.js):

  $stateprovider.state('Page', {
        url: '/Page/:userId',
        templateUrl: 'App/Pages/page.html',
        controller: 'pageController'
    })

my app.js

 angular.module("myApp", [
  // User defined modules
  'myApp.Pages', // Pages
  'myApp.Core', // Core

  // Angular modules
  'ui.router', // state routing
  'ngRoute', // angular routing
  'LocalStorageModule', //local browser storage
  'angularRangeSlider',
  'ngFileUpload'
])

Any ideas?

Upvotes: 0

Views: 71

Answers (1)

Pipeline
Pipeline

Reputation: 1059

$stateParams instead of $routeParams

Upvotes: 1

Related Questions