10

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

4

2 回答 2

7

嵌套状态将在其父模板的ui-view元素中呈现(如果没有父模板,则在 root 中呈现ui-view)。确保您阅读了文档的“嵌套状态和视图”部分。

于 2013-10-10T11:31:55.600 回答
-2

请注意父子命名约定!

.state('profile.forgot',{ 
        url : '/forgot',
        templateUrl: 'views/profile.forgot.html',
        controller: 'forgotCtrl'
      })
于 2014-01-14T22:50:00.443 回答