J
J
jenya77712016-12-16 23:46:34
Angular
jenya7771, 2016-12-16 23:46:34

How to pass parameter to stateProvider?

myApp.config(function($stateProvider, $urlRouterProvider, $locationProvider, authorizedchek) {
.state('panel', {
    url: '/panel',
    templateUrl: 'templates/panel.php',
    controller: 'panelCtrl'
})
.state('panel.admin', {
    url: '/admin',
    controller: 'adminCtrl',
    data: {},
    templateUrl: function(){
        if (param == true){
            return 'templates/admin.php'
        }
    }
})
});

What are the ways to pass parameters to data and to the param variable?
Is it possible to pass parameters directly from the authorizedcheck service?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SergeyBugai, 2016-12-17
@SergeyBugai

All parameters are available through $state, data is in $state.current.data, params can be found in $state.params or $stateParams.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question