angularjs multiple resolve with loadsequence and auth permission

删除回忆录丶 提交于 2019-12-06 05:56:18

As described in the documentation of ui-router :

The resolve property is a map object. The map object contains key/value pairs of:

key – {string}: a name of a dependency to be injected into the controller.

factory - {string|function}: If string, then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before the controller is instantiated and its value is injected into the controller.

so you can configure your state adding functions in your state resolve :

.state('app.example', {
    url: "/example",
    templateUrl: "assets/views/example.html",
     resolve: { 
scripts: loadSequence('jquery-sparkline', 'exampleCtrl').deps,
currentAuth: function(Auth){ return Auth.$requireSignIn();}
},
    title: 'example',
    ncyBreadcrumb: {
        label: 'example'
    }
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!