i have one page (.aspsx) open by angularjs modal, this is the code:
<form id="form1" class="form-horizontal" runat="server">
<div class="modal-header">
<div style="float: left; display: block;">
<h3 class="modal-title">{{vmc.title}}</h3>
</div>
<div style="float: right; display: block;">
<asp:Button CssClass="btn btn btn-success" runat="server" ID="btnCreaUser" OnClick="btnCreaUser_Click" Text="Save" />
<button class="btn btn-warning" data-ng-click="vmc.close()">Cancel</button>
</div>
<div style="clear: both;"></div>
</div>
When the "Cancel" button is clicked, call the method in the controller:
function close() {
var type = "cancel";
$uibModalInstance.dismiss({ type: type, result: null });
}
The page is closed correctly, but after the close there is a redirect to the modal page (with incorrect path, only the page name) and i have an error.
How can i prevent the redirect?
thanks
UPDATE With the type="button" attribute, the "Cancel" button works correctly.
But now i've notice that the asp:button has the same problem.
It's because
button
default type is submit, which submits the form. Usetype="button"
attribute:Read the MDN docs