Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 从父状态继承时角度UI路由器出现问题_Angularjs_Angular Ui Router - Fatal编程技术网

Angularjs 从父状态继承时角度UI路由器出现问题

Angularjs 从父状态继承时角度UI路由器出现问题,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我的角度UI路由器配置有问题 我有一个摘要已验证状态,我的所有已验证页面都从该状态继承。此外,我还有一个仪表板状态,它试图使用父项:“authenticated”符号从该已验证状态继承 以下是我的配置: .state('authenticated', { abstract: true, resolve: { currentMember: ['$rootScope', '$q', function ($rootScope, $q) {

我的角度UI路由器配置有问题

我有一个
摘要
已验证
状态,我的所有已验证页面都从该状态继承。此外,我还有一个
仪表板
状态,它试图使用
父项:“authenticated”符号从该已验证状态继承

以下是我的配置:

   .state('authenticated', {
        abstract: true,
        resolve: {
            currentMember: ['$rootScope', '$q', function ($rootScope, $q) {
                return $rootScope.authenticated || $q.reject({unAuthorized: true});
            }]
        }
    })
    .state('dashboard', {
        url: '/dashboard',
        controller: 'DashboardCtrl',
        templateUrl: 'dashboard/views/dashboard.view.html',
        parent: 'authenticated'
    })
但是,使用上述配置,我的仪表板页面始终为空

如果我注释掉父属性,如下所示:

//parent: 'authenticated'
..然后仪表板视图将正确填充其内容


有人能帮忙吗?

我们需要的是一个目标对于我们的子视图,我们需要一个设置:
模板:“
在父状态定义中:

.state('authenticated', {
    abstract: true,
    template: "<ui-view />", // here
    resolve: {
        currentMember: ['$rootScope', '$q', function ($rootScope, $q) {
            return $rootScope.authenticated || $q.reject({unAuthorized: true});
        }]
    }
})
.state('contacts.detail', {
  views: {
    ////////////////////////////////////
    // Relative Targeting             //
    // Targets parent state ui-view's //
    ////////////////////////////////////

    // Relatively targets the 'detail' view in this state's parent state, 'contacts'.
    // <div ui-view='detail'/> within contacts.html
    "detail" : { },            

    // Relatively targets the unnamed view in this state's parent state, 'contacts'.
    // <div ui-view/> within contacts.html
    "" : { }, 

    ///////////////////////////////////////////////////////
    // Absolute Targeting using '@'                      //
    // Targets any view within this state or an ancestor //
    ///////////////////////////////////////////////////////

    // Absolutely targets the 'info' view in this state, 'contacts.detail'.
    // <div ui-view='info'/> within contacts.detail.html
    "info@contacts.detail" : { }

    // Absolutely targets the 'detail' view in the 'contacts' state.
    // <div ui-view='detail'/> within contacts.html
    "detail@contacts" : { }

    // Absolutely targets the unnamed view in parent 'contacts' state.
    // <div ui-view/> within contacts.html
    "@contacts" : { }