robe007
robe007

Reputation: 3927

Define 'parent' value from param in Angular Ui-Router

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?

Upvotes: 1

Views: 48

Answers (1)

Radim K&#246;hler
Radim K&#246;hler

Reputation: 123861

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...

Upvotes: 1

Related Questions