Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularJS nested abstract views

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

like image 759
pratap Avatar asked Jul 19 '14 16:07

pratap


1 Answers

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

like image 146
Radim Köhler Avatar answered Dec 21 '22 02:12

Radim Köhler