ui-router 1.0.0 beta和嵌套解析:如何重写

时间:2016-12-01 16:07:11

标签: angularjs angular-ui-router beta

我目前正试图从ui-router 1.0.0-alpha.5迁移到1.0.0.beta.3,而且我不知道如何重写我州的解决部分。我非常确定它相对于" 9)BC-BREAK:删除对JIT做出决议的支持。" https://github.com/angular-ui/ui-router/releases/tag/1.0.0-beta.1 但是我不确定我是否可以保持我的决心,或者我是否必须将我的所有8个结果转移到transition.onEnter。

目前的代码是:

.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
    }

和购物车就像:

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

提前致谢。

0 个答案:

没有答案