1

Well, I have this situation:

$stateProvider
.state("main", { abtract: true, url:"/main",
  views: {
   "viewA": {
     templateUrl:"main.html"
   }
 }
})
.state("other", {
  parent: ':foo', // Want here the foo param too (:
  //url: '/:foo', // Here it takes de foo param
  views: {
   "viewB@main": {
    templateUrl:"hello.html"
   }
  },
  controller: function($stateParams, $scope, $state) {
   var foo = $stateParams.foo;
  }
})

And I call it, like this:

<button ui-sref="other({foo: 'main'})">Hello World</button>

It is possible to have the 'foo' param in the 'parent' property like it was it the 'url' param?

Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
robe007
  • 3,523
  • 4
  • 33
  • 59

1 Answers1

1

It is possible to have the 'foo' param in the 'parent' property like it was it the 'url' param?

No, it is not possible.

State definition must be completely registered before it is used. (Even if it is loaded lazily with deferIntercept(defer))

Evaluation of url params comes too late...

Community
  • 1
  • 1
Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
  • 1
    Well, thanks for your answer. This has take me to make another question => [How to reduce number of 'states' with same 'templateUrl' using Angular Ui-Router](http://stackoverflow.com/q/33107986/2954267) – robe007 Oct 13 '15 at 16:34