亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

angular.js - How to specify the secondary view to display the default page when the ui-router view is nested?
我想大聲告訴你
我想大聲告訴你 2017-05-15 17:09:45
0
7
1293


The specific situation is like this. Now a problem is: when jumping to the user page, the uiview on the right is empty, and you have to click on the navigation on the left To insert a template, how to set the default display page of the secondary view in the routing?
Code above:
`$stateProvider

.state('user', {
    url: '/user',
    views: {
        '': {
           templateUrl: 'public/front/temphtml/usercenter/userindex.html' 
        }
    }  
})
.state('user.a', {
    url: '/a',
    views: {
       'content@user': {
           templateUrl: 'public/front/temphtml/usercenter/a.html',
           controller: 'userCtrl'
       } 
    }
})
.state('user.b', {
    url: '/b',
    views: {
       'content@user': {
           templateUrl: 'public/front/temphtml/usercenter/b.html',
           controller: 'userCtrl'
       } 
    }
})`
我想大聲告訴你
我想大聲告訴你

reply all(7)
阿神

Tested and can solve your problem.
.state('user', {

url: '/user',
views: {
    '': {
       templateUrl: 'public/front/temphtml/usercenter/userindex.html' ,
       controller: function($state){
            $state.go('user.a');//默認(rèn)顯示第一個(gè)tab
        }
    }
}  

})
.state('user.a', {

url: '/a',
views: {
   'content@user': {
       templateUrl: 'public/front/temphtml/usercenter/a.html',
       controller: 'userCtrl'
   } 
}

})
.state('user.b', {

url: '/b',
views: {
   'content@user': {
       templateUrl: 'public/front/temphtml/usercenter/b.html',
       controller: 'userCtrl'
   } 
}

})`

阿神
.state('user', {
    //我覺得你進(jìn)到user頁(yè)面直接設(shè)置你需要默認(rèn)顯示頁(yè)面的url就好了
    url: '/a',
    views: {
        '': {
           templateUrl: 'public/front/temphtml/usercenter/a.html' 
        }
    }  
})
.state('user.a', {
    url: '/a',
    views: {
       'content@user': {
           templateUrl: 'public/front/temphtml/usercenter/a.html',
           controller: 'userCtrl'
       } 
    }
})
.state('user.b', {
    url: '/b',
    views: {
       'content@user': {
           templateUrl: 'public/front/temphtml/usercenter/b.html',
           controller: 'userCtrl'
       } 
    }
})`
大家講道理

I usually set a default page to execute $state.go();

under certain judgment conditions

For example, I set up the index router, and then set up an index.homepage

I will judge after the user logs in to the page. If the login is successful, jump directly to index.homepage. Of course, the template configured in index.homepage is the default page;

Total value, just use $state.go() to point to a route when you need it.

伊謝爾倫

Set the default:

app.config(function($urlRouterProvider){
    $urlRouterProvider.when('', '/index');
});
大家講道理

It should be forbidden to jump to /user(添加屬性 abstract:true). There's no reason to do this, just jump to the path you want.

我想大聲告訴你

How to solve the address return problem involved in multi-level routing

Ty80

Does the question owner have a solution? Please answer the same question...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template