Angularjs ng-change event demonstration, angularjsng-change
Exercise the ng-change event in angularjs today.
For example, when a user makes a choice, there is no user-appropriate option in the options specified by the system. In this case, you can enter the following information.
The text box at the beginning is hidden. It is displayed only when the user selects the checkbox.
In the model of the angularjs program, the value of IsVisible is false.
In this way, the text box is hidden when the program is running.
Next, I need to add a Checkbox in the program:
The above ng-change value is an angularjs name ShowHide:
Finally, let's look at the example. I believe you can understand and understand what it means:
Complete angularjs code:
Var appoo = angular. module ('app1', []); appoo. controller ('ctrl1', function ($ scope) {$ scope. isVisible = false; $ scope. showHide = function () {$ scope. isVisible = $ scope. showOtherDescript ;};});Source Code
Complete html code:
<Div ng-app = "App1" ng-controller = "Ctrl1"> <input id = "Checkbox1" type = "checkbox" ng-model = "ShowOtherDescript" ng-change = "ShowHide () "/> other instructions <div ng-show =" IsVisible "> <input id =" Text1 "type =" text "/> </div>Source Code