gpt4 book ai didi

javascript - Angular UI 弹出错误 : $uibModal is undefined

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:29:49 27 4
gpt4 key购买 nike

我正在尝试让 AngularUI 模态运行,但它给我一个错误($uibModal 未定义)以及令人头疼的问题。

我使用的是 angular-ui-bootstrap-0.14.3 版本。 (所以它使用 $uibModal 而不是 $modal)

错误显示在行 var modalInstance = $uibModal.open({...

这是我的 Controller (包含点击事件)的精简版

'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')
};
}

这是接收 Controller

    '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.

最佳答案

哦,我没有为 $uibModal、$log 注入(inject)依赖项。

关于javascript - Angular UI 弹出错误 : $uibModal is undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33550995/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com