从子路线转换时,如何调用再次调用控制器注入?

时间:2017-07-25 01:15:22

标签: javascript angularjs angular-ui-router angularjs-scope

我希望父控制器在状态从子级更改为父级时再次解析其注入。

    .state('settings.billing', {
        url: '/billing',
        controller: 'BillingCtrl as vm',
        template: require('./templates/billing.tpl.jade'),
        resolve: {
            sources: function(StripeService) {
                return StripeService.getSources();
            }
        }
    })
    .state('settings.billing.newsource', {
        url: '/add-source',
        onEnter: showAddSourceModal
    })


function showAddSourceModal($state, $modal) {
    $modal.open({
        template: require('./templates/add-source.tpl.jade')(),
        controller: 'AddSourceCtrl as vm',
        backdrop: true,
        keyboard: true,
        size: 'md'
    })
    .result
    .finally(function() {
        $state.go('^');
    });
}

基本上我想要在关闭模态时再次调用BillingCtrl的源代码。有可能吗?

0 个答案:

没有答案