angularjs - urlrouterprovider - ui-router教學



UI-路由器1.0.0測試版和嵌套resolves:如何重寫 (0)

我目前正試圖從ui路由器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();
        }
    }
}

提前致謝。