Ui-router 1.0.0 beta and nested permissions: how to rewrite

I'm currently trying to switch from ui-router 1.0.0-alpha.5 to 1.0.0.b.3, and I don't know how to rewrite part of the permissions of my states. I am sure this is relative to "9) BC-BREAK: remove support for JIT resolution." https://github.com/angular-ui/ui-router/releases/tag/1.0.0-beta.1 but I'm not sure if I can save my solution, or if I have to move all my 8 transition permissions .onEnter.

Current code:

.state('main', {
abstract: true,
url: `^${BASE_URL}?appName`,
template: '<main></main>',
resolve: {
    cms: (CmsService) => {
        return CmsService.init(); // Promise
    },
    gameDesc: (GameDescriptionService) => {
        return GameDescriptionService.init(); // Promise
    },
    cartInit: (cms, gameDesc, Cart) => {
        // Cart can't be injected before cms and gameDesc have resolved
        return Cart;
    },
    stuffWithCart: (cartInit, Cart) => {
        // Using Cart
    }

and the basket looks like this:

export default /*@ngInject*/ function (CmsService, GameDescriptionService) {
    class Cart {
        constructor() {
            this.cms = CmsService.getCms();
            this.gameDesc = GameDescriptionService.getDescription();
        }
    }
}

Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1662558/


All Articles