通过角度模态服务从另一个模块调用控制器

时间:2017-04-22 04:33:32

标签: angularjs mean-stack mean meanjs

  

块引用

我创建了2个crud模块:客户和预订。在模块预订中,我使用函数调用模块客户的模态:

function addCustomer(){
  var _modal_create = ModalService.showModal({
    templateUrl: 'modules/customers/client/views/form-customer.client.view.html',
    controller: 'CustomersController',
    controllerAs: 'vm',
    resolve: {
      customerResolve: function(CustomersService){
        return new CustomersService();
      }
    },
  }).then(function(modal) {
      modal.element.modal();
  });
}

我将依赖添加到预订模块的配置

angular
.module('bookings',['customers'])
.config(routeConfig);

按钮调用函数addCustomer

<button class="btn btn-warning" ng-click="vm.addCustomer()">
    <i class="glyphicon glyphicon-plus"></i> Customer
</button>

我有错误

  

错误:[$ injector:unpr]未知提供者:customerResolveProvider&lt; - customerResolve&lt; - CustomersController

抱歉我的英语不好。

0 个答案:

没有答案