خرید بک لینک

Vote count: 0

TLDR: I wish to add a field to the $stateProvider called "layout" that tells the ui which layout it should load before the routes html

So i know that is is currently possible to make a layout variable by creating an abstract class:

.state('dashboard', {
    abstract: true,
    url: '/dashboard',
    templateUrl: 'tpl/app.html',
})

However there are sveral reason as to why i do not wish this:

In my application there are two types of layouts:

Client layout

Which has a url of: tpl/client/client.html

Admin layout

Which has a url of: tpl/app.html

Now in my application i have many routes and states this is because my application is divided into modules and each module has their own routes

An example is my Dashboard module:

   angular.module('Dashboard', [])

    .config(['$stateProvider', '$urlRouterProvider', 'JQ_CONFIG', 'USER_ROLES', 'hammerDefaultOptsProvider',
        function ($stateProvider, $urlRouterProvider, JQ_CONFIG, USER_ROLES, hammerDefaultOptsProvider) {
            $stateProvider
            //lb routes
                .state('dashboard', {
                    abstract: true,
                    url: '/feedback',
                    templateUrl: 'tpl/app.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                retu uiLoad.load([
                                    'js/controllers/headerController.js'
                                ]);
                            }]
                    }
                })
                .state('dashboard.admin', {
                    url: '/dashboard',
                    templateUrl: 'tpl/app_admin_dashboard.html',
                    data: {
                        authorizedRoles: [USER_ROLES.lb, USER_ROLES.superadmin, USER_ROLES.subadmin]
                    },
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                retu uiLoad.load([
                                    'js/controllers/chart.js',
                                    'js/controllers/dashboard/DashboardController.js',
                                    'js/controllers/dashboard/ClientDashboardController.js'
                                ]);
                            }]
                    }
                })

        }]);

As you can see from this i have first an abstract state and then the states below it.

"Cut to the case what is your problem":

I wish to extend the $stateProvider to add a field called layout that tells my route which layout to use.

asked 31 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 16 فروردين 1395 ساعت: 17:45

صفحه بندی