gpt4 book ai didi

jquery - Angular 模态未关闭($uibModal)

转载 作者:行者123 更新时间:2023-12-03 23:04:21 26 4
gpt4 key购买 nike

angular
.module('angProj')
.controller('UserCtrl',
['$scope', '$uibModal',
function ($scope, $uibModal) {

$scope.results = function (content, completed) {
var modalInstance = $uibModal.open({
backdrop: 'static',
keyboard: false,
animation: $scope.animationsEnabled,
templateUrl: '/Scripts/angularApp/views/user-modal.html',
controller: 'UserModalCtrl',
resolve: {
items: function () {
return $scope.items;
}
}
});

if (!completed || content.length === 0) {
return;
}

modalInstance.close();
modalInstance.dismiss('cancel');

我无法在用户添加完成时关闭模型。在用户模式上,我显示进度条。代码运行良好,没有错误,但模式保持打开状态。我也尝试了 $uibModalInstance 但 Controller 抛出错误:未知提供者(无法在同一个 UserCtrl 上注入(inject) $uibModalInstance)我正在注入(inject) ui.bootstrap (ui-bootstrap-tpls-1.1.2.js)

感谢您的宝贵时间。

最佳答案

UserModalCtrl Controller 中使用 modalInstance.close()

app.controller('UserModalCtrl', ['$scope', '$modalInstance' function($scope ,modalInstance {
$scope.close = function () {
modalInstance.close();
};
}]);

关于jquery - Angular 模态未关闭($uibModal),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35177305/

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