I am just embedding AngularJs on a website written in asp.net web forms.
I find out when the button is ng-Submiton the button, the form also makes a post call.
ng-Submit
How to stop formfrom submittingand angular do its work.
form
submitting
angular do its work
My sample code is below.
<form id="form1" runat="server"> <div > <input type="text" data-ng-model="enteredName" ng-model-instant/> <button class="btn" value="add" data-ng-submit="addName()" >Add</button> </div> </form> //Add Name function $scope.addName = function () { $scope.names.push($scope.enteredName); $scope.enteredName = ''; };
Note : The ng-submit controller is working fine it is adding the input to the string list but after that form makes post call. and page go to IsPostBack.
The ng-submit controller is working fine it is adding the input to the string list but after that form makes post call. and page go to IsPostBack
Someone help me process the form without sending messages.
angular .NET, , , .NET MVC - .NET. , - <form>, . , - Visual Studio, :
<form>
<form runat="server" ID="Form1">
, webforms, <asp:LinkButton> , "" HTML, <input>, . , -, , - . , , , .
<asp:LinkButton>
<input>
,.NET MVC , HTML- , postbacks viewstates. , -, angular, angular , - .NET.
ng-click ng-submit. asp.net , angular.