angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.53k stars 3k forks source link

ui-router stateProvider abstract , how to share parent views for child? #3824

Closed zengfr closed 3 years ago

zengfr commented 3 years ago

when run url http://localhost:82/index.html#!/conn/list , but header footer views not show in page.
how to share parent views for child conn.list?

app.config(function ($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.when("", "conn/list");
        $stateProvider.state({
        name: 'conn',
        url: '/conn',
    abstract: true,
        views: {
            'header': {
                templateUrl: 'header.html'
            },
            'footer': {
                templateUrl: 'footer.html'
            },
           'body': {
                template: '<div ui-view="body"><div>',
            }
        }
    });
    $stateProvider.state({
        name: 'conn.list',
        url: '/conn/list',
        views: {
            'body': {
                templateUrl: 'connlist.html',
        controller: "connGrid"
            }
        }
    });