I have a contact form inside my modal window. After successful post request i want to close the modal automatically. I am using MEAN.JS
here is my controller
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
How can i close my modal after $http.post success?
I got something for you
Use:- $modalStack
And then call $modalStack.dismissAll();
Simple plunker
I used $timeout
in plunkler you can use it anywhere like $http
:-)