2

There's any way of setting the parent in Angular UI Router programmatically? Something using the $scope? like

 myPage: {
            parent: ($scope) => {
                 return $scope.parentProperty;
            },
            template,
            controller
         }
3
  • Some more context would be useful. Commented Jun 16, 2017 at 16:38
  • Are you using components? Commented Jun 16, 2017 at 16:39
  • I'm using components. The context is relatively simple, I have two pages that need use the same component, this component has 3 pages, the parent of these 3 pages should be defined by who is using the component. Commented Jun 16, 2017 at 16:45

1 Answer 1

1

In your component definition add:

bindings: { parentCtrl: '=' }

and then where ever you use the component simply add parentCtrl="$ctrl" (or whatever the name of the current controller is.)

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

Comments

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.