ng API Learning for Beasts-Ngchange, Ngchecked, Ngclick, Ngdblclick
Ngchange
Executes the given expression when the user changes the input. The expression is executed immediately, and the JavaScript onchange event is performed differently only when the change of the triggering event ends.
Format: ng-change= "value"
Value: An expression.
Using code:
<div ng-app= "Demo" >
<div ng-controller= "Testctrl" >
<input ng-change= "FN ()" ng-model= "Inputvalue"/>
</div>
</div>
<script>
Angular.module ("Demo", [])
. Controller ("Testctrl", ["$scope", function ($scope) {
$scope. fn = function () {
Alert ($scope. Inputvalue);
};
}])
</script>
This instruction is to listen to the input value, when the value changes, you need to let me do what I do what the operation.
Ngchecked
The HTML specification does not allow the browser to keep the Boolean property, just like checked. (They exist as true, not present is false) if we convert a angular expression to such a property, the bound information disappears when the browser removes the property. The ngchecked directive solves the problem of checked this property. This supplemental instruction is not removed by the browser and provides a permanent and reliable place to store the binding information.
Format: ng-checked= "value"
Value: Expression result is a Boolean type
Using code:
<input type= "button" ng-click= "isChecked =!ischecked" value= "Toggle"/>
<input type= "checkbox" ng-checked= "isChecked"/>
Secretly, this command in the choice of configuration when it is very useful oh.
Ngclick
The Ngclick directive allows a specified expression to be executed when an element is clicked.
Format: ng-click= "value"
Value: An expression
Using code:
<input type= "button" value= "Add-count" ng-click= "count=count+1" ng-init= "count=0;"/>
{{count}}
Mouse click event, do not say more.
Ngdblclick
The Ngdblclick directive allows you to execute a specified expression on an DblClick event.
Format: ng-dblclick= "value"
Value: An expression
Using code:
<input type= "button" value= "Add-count" ng-dblclick= "count=count+1" ng-init= "count=0;"/>
{{count}}
Double-click the mouse event without explanation.
After summing up, early to bed and early to good health, the beast to sleep-. -You have to get up early to work tomorrow.
The beast's angular Api learning, translating and understanding-Ngchange, ngchecked, Ngclick, Ngdblclick