Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirecting from a modal using ng-click and the data-dismiss doesn't work

I was trying to navigate from a modal in a page to another page by adding a function to ng-click. When I remove the function assigned to ng-click, the data-dismiss works properly and the modal gets removed. But when I use the ng-click with a function, which redirects to an alternative page, it gets directed to the page, but the modal has not been dismissed. (the new page seems in the disabled state)

<button type="button" class="btn btn-success" ng-click="addNewProject()" 
data-dismiss="modal">Add Project</button>

The addNewProject() function redirects to the other page and adds the details in the modal to the database. I would like to know a way to get the page which was loaded later, in the editable way. (the modal should be completely removed.)

like image 285
Rajith Gun Hewage Avatar asked Dec 17 '14 05:12

Rajith Gun Hewage


2 Answers

$(".modal-backdrop").hide();

Adding the above line in the ng-click function got rid of the issue.

like image 117
Rajith Gun Hewage Avatar answered Oct 27 '22 22:10

Rajith Gun Hewage


Please have a look at http://angular-ui.github.io/bootstrap/

  1. Refer Closing Twitter Bootstrap Modal From Angular Controller

    $scope.close = function(result){ dialog.close(result); };

or

  1. use this inside ng-click function

    $('#myModal').modal('hide');

like image 35
4dgaurav Avatar answered Oct 27 '22 21:10

4dgaurav