After submitting the form, a request is sent to the server and a modal window appears. Once the server responds with success, the modal should be closed and a new page should load.
I attempted using ng-show and ng-if in the controller to toggle visibility based on certain conditions, but this doesn't handle dismissing the modal backdrop. While I can close the modal within the same page using data-dismiss="modal", how can I achieve this from the controller before redirecting to a new page?
<div id="myModal" class="modal fade" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<img src="img/processing.gif" id="ajaxSpinnerImage" title="working...">
</div>
</div>
Clicking on the Submit button triggers the following action
<button type="submit" data-toggle="modal"
data-target="#myModal" ng-click=" formsubmit(orderForm.$valid); ></i>
Place Order </button>
Initiating a server call from the Controller
$scope.formsubmit = function (isValid) {
if (isValid) {
$http.post($scope.url).
success(function (data, status) {
//NEED TO CLOSE THE MODAL HERE
//Proceeding to a new page
window.location.assign("NewPageToNavigate.html");
})
}