Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular UI Router - nested routes does not work on templates with nested state

Here is my code:

.state('profile',{ 
        url : '/profile',
        templateUrl: 'views/user.html', 
        controller: 'UserCtrl'
      })
      .state('profile.forgot',{ 
        url : '/delivers',
        templateUrl: 'views/user_forgot.html', <- this template not appear, when state is active
        controller: 'forgotCtrl'
      })

<a ui-sref="profile.forgot">Forgot your pasword?</a>
<div class="panel" ui-view=""></div>

When i click on link, in ui-view appeared template and controller of parent state. AngularJS version is 1.2.0-rc.2

like image 662
user2820445 Avatar asked Sep 27 '13 16:09

user2820445


Video Answer


1 Answers

A nested state will render within the ui-view element of its parent template (which, if parentless, renders within the root ui-view). Make sure you read the 'Nested States & Views' section of the docs.

like image 81
Phil Thomas Avatar answered Oct 05 '22 08:10

Phil Thomas