The correct way to inject an angular controller dependency inside an angular.ui modal

前端 未结 4 1822
生来不讨喜
生来不讨喜 2020-12-14 06:33

following angular.ui Modal example shows the modalInstance calling a ModalIntanceCtrl which is later created as a function:

var Mod         


        
4条回答
  •  感动是毒
    2020-12-14 07:01

    You question is not very clear, but if you declare controller using the module API, then you can provide the controller to the modal service as a string

    myApp.controller('ModalInstanceCtrl', ['$scope', function($scope) { $scope.greeting = 'Hola!'; }]);
    

    controller: 'ModalInstanceCtrl',

    The same can be done for loginCtrl if you want to use that in the modal service.

提交回复
热议问题