How to get parameters from url



I’m facing a problem using $urlRouterProvider instead of angular’s $routeProvider.

What I would normally do with $routeProvider is:

 .when('myurl/:param', {
    templateUrl: 'whatever.html',
    controller: MtCtrl'

and then

 .controller('MtCtrl', function ($scope, $routeParams) {

I’m trying that way with $urlRouterProvider:

.state('tabs.home', {
  url: "/home/:param",
  views: {
    'home-tab': {
      templateUrl: "home.html",
      controller: 'HomeTabCtrl'

and in the controller

 .controller('HomeTabCtrl', function ($scope, $routeParams) { 

but I’m getting undefined.

Anybody knows how to get that working?

Thank you.


Take a look at this :wink:


Awesome gregorypratt, thank you.


video about ui-router