Reputation: 8432
When $modalInstance.dismiss
is initiated, the whole page is redirected to the modal's templateUrl
instead of the modal is simply only closed. This does not happen when ESC is pressed or you press outside of the modal. Why could this be happening?
Upvotes: 1
Views: 1456
Reputation: 8432
The problem appeared to be because the Cancel button was within a <form>
tag. When a <button>
is within a <form>
, angularjs redirects the user to the <form>
's action url. Since with angularjs forms are not needed, removing the form tags resolved the problem. Another way would be to place the buttons outside the form's tag.
Upvotes: 6