Ng-Mouseup-2

 

We display alphabets from A to Z using ng-repeat directive.When mouse up event will fire then the style that is bind to ng-mouseup event will apply on alphabet means alphabets reamins in original position.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName" ng-init="genetareLetter()"> <span ng-repeat="p in ltrs"><i ng-mouseup="style={}" ng-mousedown="style={color:'blue','background-color':'gray','font-size':'20px', 'cursor':'pointer'}" ng-style="style">{{p}},</i></span> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.ltrs = []; $scope.genetareLetter = function () { var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for (i = 0; i < letters.length; i++) { $scope.ltrs.push(letters[i]); } }; }]); </script> </body> </html>
Output