The ng-mouseup is used to
specify to perform the custom behaviour on mouse up event.
If you want to add and fire a mouse up event on HTML button that time we need to
use these events.
When you mouse
up on button in the below example, the ngMouseup function get
called.
As you can see in the below
controller function " mouseup" get called after ngMouseup
on button.
The example as,
//The HTML code-sample: <button ng-mouseup="mouseup()">NG-MOUSEUP </button> //The AngularJs code-sample : var app = angular.module('myApp', []); app.controller('ngClickCtrl', function ($scope) { $scope.firstName = "Anil"; $scope.lastName = "Singh"; $scope.IsActive = false; $scope.mouseup = function () { $scope.IsActive = true; }; }); //The AngularJs and HTML code <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>What is ng-mouseup directive? Why we use it?</title> @*<script src="https://code.angularjs.org/1.4.1/angular.js"></script>*@ <script> var app = angular.module('myApp', []); app.controller('ngClickCtrl', function ($scope) { $scope.firstName = "Anil"; $scope.lastName = "Singh"; $scope.IsActive = false; $scope.mouseup = function () { $scope.IsActive = true; }; }); </script> </head> <body ng-app="myApp"> <div ng-controller="ngClickCtrl"> <div> First Name: <input type="text" ng-model="firstName"> Last Name: <input type="text" ng-model="lastName"> <div ng-show="IsActive"> <h3>Full Name: {{firstName + " " + lastName}} </h3></div> </div> <div> <button ng-mouseup="mouseup()">NG-MOUSEUP </button> </div> </div> </body> </html>The live output as,
Blogger Comment
Facebook Comment