We can display or hide the div element on the basis of value of
In this example
ng-click directive call the
showAlert() function which will show the alert "This is an example of ng-click".
In this example we can increase or decrease the value of count variable.In first button click we can decrease the value of count and on second button click we can increase the value of count because
ng-click directive increase or decrease the value of count.
In this example we can increase the count1 and count2 variable on click of anchor element and button respectively.
isCheck is a variable with
ng-model directive which set the value of checkbox to
isCheck is true it will not increase count2 because
ng-disabled directive disable the button.
In this example
ng-click will the
changeColor() function which is used to change the color of div and color of color code in pre element if we click on the button.
In this example we can set and clear the value of textbox.Button having
Set Value text will disable if textbox is empty.If we type in textbox then click on
Set Value button it will display the value of textbox and button having
Clear Value text will clear the value of textbox and set the text Learn It.
In this example we can create list of options with
ng-options directive.Selected textbox value will bind to myName variable with
ng-model directive.If we click on button it will call the
executeFunction(myName) with selected value as parameter which display alert of selected value of textbox.
In this example of
ng-click, we will use the animation to show and hide the div. Clicking on the button with text
Slide Down will add the class
slideDown which will basically show the div using animation and
Slide Up button will hide the div. See the output: