ng-keyup

What is ng-keyup:ng-keyup used to perform any task on keyup event...
Description of ng-keyup:ng-keyup has priority 0.Can evaluate and task on keyup event..
Syntax of ng-keyup:
<element ng-keyup="expression">

</element>
or


<input ng-keyup="expression"/>
How to Use ng-keyup/ng-keyup Example::
 Example 1:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr" ng-init="mycount=1">
        <div>
            Angularjs Example of ng-keyup
             value of mycount before ng-keyup:   {{mycount}}
            <input ng-keyup="mycount=mycount+1" />
            value of mycount after ng-keyup:   {{mycount}}
        </div>
    </div>
</div>

Example 2:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr" ng-init="mycount=1">
        <div>
            Angularjs Example of ng-keyup
            value of mycount before ng-keyup:   {{mycount}}
            <input ng-keyup="myfun()" />
            value of mycount after ng-keyup:   {{mycount}}
        </div>
    </div>
</div>

<script>
    angular.module('webapp', []).controller('angularjsexampleCtlr', function ($scope, $http) {
        $scope.myfun = function () {
           $scope.mycount = $scope.mycount + 1;
        }
    });

</script>

No comments :

Post a Comment