Ng-Mouseup-6

 

In this example of Ng-Mouseup, We have img.selected as false bydefault and on ng-mouseup the value of it will be set to true. See the code:

 
 
 
<!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> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="app"> <div class="container"> <div class="row" ng-controller="myController"> <div class="col-md-3"></div> <div class="col-md-6 well"> <h3>Select Images On Mouse Up</h3> <div class="row text-center"> <div class="col-md-4" style="margin-bottom:20px;" ng-repeat="img in images" ng-mouseup="style={ 'height': '90px', 'width': '140px' };img.selected=true"> <div class="row"> <img ng-style="style" ng-src="{{img.path}}" /> </div> <div class="row"> <img ng-hide="img.selected" height="30" width="30" src="http://learnit.visrosoftware.com/datafiles/unchecked.png" /> <img height="30" width="30" ng-show="img.selected" src="http://learnit.visrosoftware.com/datafiles/checked.png" /> </div> </div> </div> </div> <div class="col-md-3"></div> </div> </div> <script> var app = angular.module("app", []); app.controller('myController', ['$scope', function ($scope) { $scope.style = { 'height': '100px', 'width': '150px' }; $scope.images = [{ id: '1', path: 'http://learnit.visrosoftware.com/datafiles/win1.png', selected: false }, { id: '2', path: 'http://learnit.visrosoftware.com/datafiles/win2.jpg', selected: false }, { id: '3', path: 'http://learnit.visrosoftware.com/datafiles/win3.jpg', selected: false }]; }]); </script> </body> </html>
Output