6

I am using StateProvider library to create nested views in my AngularJS app. I had an abstract view defined at the root and now need to define another abstract view as 2nd level child to the previously created abstract view.

Facing issues with this, Not sure if I can have nested abstract views or not. Any idea.

greatly appreciate your help.

Thanks

1 Answer 1

9

There could be more abstract-nested states in hierarchy. This example shows it in action, definition of these states could be like this:

$stateProvider
  .state('main', {
      url: "",
      abstract: true,
      templateUrl: 'tpl.main.html',
  })
  .state('main.middle', {
      url: "",
      abstract: true,
      templateUrl: 'tpl.middle.html',
  })
  .state('main.middle.alpha', {
      url: "/alpha",
      templateUrl: 'tpl.leaf.html',
      controller: function ($scope, $state){
        $scope.state = $state.current;
      },
  })

Check the plunker. As we can see, the root (main) and its child (middle) do not use url at all... but they could..

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.