softsimon / ui-router-route-to-components

UI-Router Route To Component Extension
The Unlicense
27 stars 10 forks source link

Using nested views content is never loaded #5

Open mtpultz opened 8 years ago

mtpultz commented 8 years ago

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 commented 8 years ago

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);

})();
GONNAGITU72 commented 10 months ago

(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);

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