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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.