Angularjs's Ng-change Event demo

Source: Internet
Author: User

Practice Angularjs's Ng-change event today.

For example, when the user makes a choice, there is no user-appropriate option in the options specified by the system. At this point we can let the user fill out.



The first text box is hidden. It is not displayed until the user selects a checkbox.


The value of IsVisible in the model of the ANGULARJS program is false.

This way, when the program is running, the text box is hidden.

Next, I need to add a checkbox to the program:

The value of the ng-change above is a angularjs name showhide:

Finally take a look at the example and believe you can read and understand the meaning of the expression:

The Complete ANGULARJS code:

var appoo = angular.module (' App1 ', []);        Appoo.controller (function  ($scope) {            false;             function () {                = $scope. Showotherdescript;};        });
Source Code


Full HTML code:

<DivNg-app= "App1"Ng-controller= "CTRL1">                    <inputID= "Checkbox1"type= "checkbox"Ng-model= "Showotherdescript"Ng-change= "showhide ()" />Other Instructions<DivNg-show= "IsVisible">                       <inputID= "Text1"type= "text" />        </Div>    </Div>
Source Code

Angularjs's Ng-change Event demo

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.