Is there any way to simplify angular -ui-router solution?

I already did it:

resolve: {
    required_data: function($q, testService) {
        return $q.all([
            testService.getAdminTestLevel(),
            testService.getAdminTestStatus(),
            testService.getAdminTestType()
        ])
    }
}

Is it possible for me to encode this without the required_ data, just by connecting the function to resolve:?

+4
source share
1 answer

No . angular -ui-router wiki says

The permission property is a map object.

This was probably chosen so that the permitted data was easily accessible on the route. It works this way in both ngRoute and u-router.

You can simplify by doing what you have in the function, this is the testService method, then run function(testService), { return testService.doAdminChecks(); }or similar.

+5
source

All Articles