priyanka

priyanka

  • NA
  • 215
  • 123k

asp Textbox value lost on postback using angularjs in c#

May 26 2017 3:29 AM
I want to find sum of two value and put the value in third textbox using angular js,
no doubt code is working ,but typed value in textbox gets disappear  after few second.
 
So,will u please suggest me why it's happen and provide me some working code.
 
My code working code is as follows:
 
 <script type="text/javascript>
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.myFunc = function() {
$scope.third=parseFloat($scope.first)+parseFloat($scope.second);
};
}]);
 
</script>
 
 <form ng-app="myApp" ng-controller="myCtrl">
<asp:TextBox ID="txtFirst" runat="server" ng-model="first">
<asp:TextBox ID="txtSecond" runat="server" ng-model="second">
 <asp:TextBox ID="txtThird" runat="server" ng-model="third">
<asp:Button ID="btnSubmit" runat="server" Text="Submit"  ng-click="myFunc()"   />
</form>

 

Answers (5)