Saturday, 14 November 2015

ng-dblclick

What is ng-dblclick:ng-dblclick used to perform a task when element is double clicked..
Description of ng-dblclick:This directive shows a custom behavior on double click on specified element.
This directive has priority 0..
Syntax of ng-dblclick:
<element ng-dblclick="myfun()"></element>
Or

<div ng-dblclick="msg='This is angularjs example of ng-dblclick'"></div>
How to Use ng-dblclick/ng-dblclick Example::
Example 1:
<div ng-init="msg='angularjs example'">
    msg1:{{msg}}
    <div ng-dblclick="msg='This is angularjs example of ng-dblclick'">
        msg2:{{msg}}
    </div>
</div>
o/p: msg:angularjs example
     when ng-dblclick fire
     msg:This is angularjs example of ng-dblclick
Example 2:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr">
        <div>
            Angularjs Example of ng-dblclick
            <button ng-dblclick="myfun()"></button>
        </div>
    </div>
</div>

<script>
    angular.module('webapp', []).controller('angularjsexampleCtlr', function ($scope, $http) {
        $scope.myfun = function () {
            $scope.msg = "Hey this ng-dblclick result.";
            alert($scope.msg);
        }
    });    

</script>

No comments :

Post a comment