Prev Demo
AngularJS
>
Change Events
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <h3> Angular JS change Events</h3> Change the value of these elements. <hr /> <script> var app = angular.module("app", []); app.controller("ChangeController", function ($scope) { $scope.CheckBoxChanged = function () { $scope.CheckBoxStatus = $scope.chkValue; }; $scope.TextBoxChanged = function () { $scope.TextBoxStatus = $scope.txtValue; }; $scope.DropDownChnaged = function () { $scope.DropDownStatus = $scope.dropValue; }; }); </script> <div ng-app="app" ng-controller="ChangeController"> <input type="checkbox" name="chk1" ng-model="chkValue" ng-change="CheckBoxChanged()" /> <p>Check box status: {{ CheckBoxStatus }}</p> <hr /> <input type="text" name="txt1" ng-model="txtValue" ng-change="TextBoxChanged()" /> <p>Text box status: {{ TextBoxStatus }}</p> <hr /> <select name="dropChange" ng-model="dropValue" ng-change="DropDownChnaged()"> <option value="M">Male</option> <option value="F">Female</option> </select> <p>Dropdown box status: {{ DropDownStatus }}</p> </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output