ui-router-route-to-components icon indicating copy to clipboard operation
ui-router-route-to-components copied to clipboard

Using nested views content is never loaded

Open mtpultz opened this issue 9 years ago • 2 comments

Using the views example content isn't loaded. The menu template is displayed, but no content appears where the view should be displayed. I just found this decorator, and it seemed to work after porting the routes to look like the example, but not within nested views. Was super happy to find this since Ionic won't be updating the router in v1.3.1 holding it at v0.2.x.

(function () {

    'use strict';

    function routes($stateProvider) {

        $stateProvider

            .state('menu', {
                name: 'menu',
                component: 'menuPage', // menu and surround template are loaded
                url: '/main',
                abstract: true
            });
    }

    routes.$inject = [
        '$stateProvider'
    ];

    angular
        .module('app')
        .config(routes);

})();

(function () {

    'use strict';

    function routes($stateProvider) {

        $stateProvider
            .state('menu.auth', {
                name: 'auth',
                url: '/auth',
                views: {
                    'content@': {
                        component: 'authPage' // authentication page is not loaded within the content area
                    }
                }
            });
    }

    routes.$inject = [
        '$stateProvider'
    ];

    angular
        .module('app')
        .config(routes);

})();

mtpultz avatar Oct 04 '16 08:10 mtpultz

Seems to work if I just do this instead:

(function () {

    'use strict';

    function routes($stateProvider) {

        $stateProvider
            .state('menu.auth', {
                name: 'auth',
                url: '/auth',
                component: 'authPage' // authentication page is now loaded
            });
    }

    routes.$inject = [
        '$stateProvider'
    ];

    angular
        .module('app')
        .config(routes);

})();

mtpultz avatar Oct 04 '16 08:10 mtpultz

(function () {

'use strict';

function routes($stateProvider) {

    $stateProvider

        .state('menu', {
            name: 'menu',
            component: 'menuPage', // menu and surround template are loaded
            url: '/main',
            abstract: true
        });
}

routes.$inject = [
    '$stateProvider'
];

angular
    .module('app')
    .config(routes);

})();

(function () {

'use strict';

function routes($stateProvider) {

    $stateProvider
        .state('menu.auth', {
            name: 'auth',
            url: '/auth',
            views: {
                'content@': {
                    component: 'authPage' // authentication page is not loaded within the content area
                }
            }
        });
}

routes.$inject = [
    '$stateProvider'
];

angular
    .module('app')
    .config(routes);

})(); - [ ] ### ~~> [* - [ ] ]()~~

GONNAGITU72 avatar Jan 17 '24 11:01 GONNAGITU72