【发布时间】:2015-04-14 09:49:12
【问题描述】:
我的模态窗口中有一个联系表格。成功发布请求后,我想自动关闭modal。我正在使用 MEAN.JS
这是我的控制器
angular.module('core').controller('FormCtrl',['$scope','$http', function($scope,$http) {
$scope.postMail = function (data) {
$http.post('/mail', data).
success(function(data, status, headers, config) {
alert('success');
//close function....??
}).
error(function(data, status, headers, config) {
});
};
}]);//formController ends
$http.post 成功后如何关闭我的模式?
【问题讨论】:
-
请阅读您链接到的文档。它清楚地描述了如何关闭一个模态,甚至提供了一个例子
-
嘿,但它没有提供如何在控制器中关闭模式:-P @rmuller
-
嗯?在那个javascript中的控制器内显然有一个close方法
-
我试过
$modalInstance.dismiss('cancel');但它说 .dismiss in undefined。 -
那个 close 方法在 $modalInstance 的控制器中,而不是在创建模态的主控制器中:-P
标签: angularjs angularjs-directive angular-ui bootstrap-modal meanjs