Guest User

Untitled

a guest
Jan 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. <img class="img-fluid img-thumbnail" ng-src="/download/{{1027}}/{{imageModel.imageID}}/"
  2. pop-over-title="{{form.tagNumber+' - '+imageModel.imageID}}" pop-over-image />
  3.  
  4. sample.directive('popOverImage', ['$mdDialog', function($mdDialog){
  5. var template='<md-dialog md-selected="tabIndex" aria-label="Image Preview">'
  6. +'<md-toolbar><div class="md-toolbar-tools"><h2 ng-bind="title"></h2><span flex></span>'
  7. +'<md-button ng-click="back()" class="md-raised" style="color:red;">Previous </md-button><md-button ng-click="next()" style="color:red;" class="md-raised"> Next'
  8. +'</md-button><md-button class="md-icon-button" ng-click="cancel()">'
  9. +'<md-icon md-font-library="material-icons" aria-label="Close dialog" class="icon-static">close</md-icon></md-button></div>'
  10. +'</md-toolbar><md-dialog-content><img ng-src="{{imageSrc}}" alt="{{title}}" class="demo-image"></md-dialog-content></md-dialog>';
  11. return {
  12. link: function($scope, elem, attrs){
  13. elem.addClass('image-click');
  14. elem.on('click',function(){
  15. var imageSrc = attrs.src;
  16. var title = attrs.popOverTitle;
  17. showLightboxModal(imageSrc,title);
  18.  
  19. });
  20. function showLightboxModal(imageSrc, title) {
  21. var confirm = $mdDialog.confirm({
  22. template: template,
  23. clickOutsideToClose: true,
  24. controller: popOverController
  25. });
  26. $mdDialog.show(confirm);
  27. function popOverController($scope, $mdDialog) {
  28. $scope.imageSrc = imageSrc;
  29. $scope.title = title;
  30. $scope.cancel = function() {
  31. $mdDialog.cancel();
  32. };
  33. $scope.back = function() {
  34. console.log("back");
  35. if ($scope.tabIndex> 0) {
  36. $scope.tabIndex--;
  37. }
  38. };
  39. $scope.next = function() {
  40. console.log("next");
  41. if ($scope.tabIndex< 2) {
  42. $scope.tabIndex++;
  43. }
  44. };
  45. }
  46. }
  47. }
  48. };
  49. }]);
Add Comment
Please, Sign In to add comment