AngularJS nested abstract views

I use the StateProvider library to create nested views in my AngularJS application. I had an abstract representation defined in the root, and now I need to define another abstract view as a child level of the second level for the previously created abstract representation.

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

really appreciate your help.

thanks

+6
source share
1 answer

A hierarchy may have more abstract nested states. This example shows this in action, the definition of these states could be:

$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 out the plunker . As we can see, the root (main) and its child (middle) do not use the url at all ... but they could ..

+9
source

Source: https://habr.com/ru/post/972508/


All Articles