我正试图让AngularUI Modal继续运行,但是它给了我一个错误($uibModal未定义)以及令人头疼的问题.
我正在使用版本angular-ui-bootstrap-0.14.3. (所以它使用$uibModal而不是$modal)
该错误显示在行var modalInstance = $uibModal.open({…
这是我的控制器的一个缩减版本(它保存了click事件)
'use strict';
angular.module('MPAapp')
.controller('workCentreCtrl',
['$scope', '$rootScope', 'toastrFactory', 'workCentreResource',
workCentreCtrl])
function workCentreCtrl($scope, $rootScope, toastrFactory, workCentreResource, $uibModal, $log) {
// Click event code to open the modal
$scope.EditWorkOrder = function (slot, max) {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: '/app/WorkOrder/Views/EditWorkOrder.html',
controller: 'EditWorkOrderCtrl',
size: 'lg',
resolve: {
Slot: function () {
return slot;
},
Max: function () {
return max;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
console.log('md opened')
};
}
这是接收控制器
'use strict';
angular.module('MPAapp')
.controller('EditWorkOrderCtrl', ['$scope', '$timeout', 'toastrFactory', 'workCentreResource', 'blockedDatesResource',
EditWorkOrderCtrl]);
function EditWorkOrderCtrl($scope, $timeout, toastrFactory, workCentreResource, blockedDatesResource, $uibModalInstance, Slot, Max) {
// rest of my code in here....
};
对此的任何想法将非常感谢.
itsdanny.
最佳答案 Doh,我没有为$uibModal,$log注入依赖项.