How to read textbox data on button click using AngularJS
Program:
<!DOCTYPE html>
<html>
<head>
<script src="angular.min.js"></script>
<meta charset="utf-8" />
<script>
//how to read textbox value on button click using angularJS
var myApp = angular.module("myModule", []);
debugger;
var empController = function ($scope) {
debugger;
$scope.textBoxValue = "this is default value";
$scope.getEmployDetails = function (getEmployDetails) {
$scope.textBoxValue = getEmployDetails;
};
};
myApp.controller("empController", empController);
</script>
</head>
<body ng-app="myModule">
<div ng-controller="empController">
<input type="text" ng-model="textboxdata" />
<button ng-click="getEmployDetails(textboxdata)">Get textbox value</button><br />
{{textBoxValue}}
</div>
</body>
</html>
Output:
If you have any queries or suggestions, please feel free to ask in comments section.
Program:
<!DOCTYPE html>
<html>
<head>
<script src="angular.min.js"></script>
<meta charset="utf-8" />
<script>
//how to read textbox value on button click using angularJS
var myApp = angular.module("myModule", []);
debugger;
var empController = function ($scope) {
debugger;
$scope.textBoxValue = "this is default value";
$scope.getEmployDetails = function (getEmployDetails) {
$scope.textBoxValue = getEmployDetails;
};
};
myApp.controller("empController", empController);
</script>
</head>
<body ng-app="myModule">
<div ng-controller="empController">
<input type="text" ng-model="textboxdata" />
<button ng-click="getEmployDetails(textboxdata)">Get textbox value</button><br />
{{textBoxValue}}
</div>
</body>
</html>
Output:
If you have any queries or suggestions, please feel free to ask in comments section.
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.