Angularjs ng-change event demonstration, angularjsng-change

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.