all files / app/main/components/material-docs/demo-partials/fabSpeedDial/demoMoreOptions/ script.js

10.53% Statements 2/19
0% Branches 0/2
12.5% Functions 1/8
10.53% Lines 2/19
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                                                                                          
(function() {
  'use strict';
 
  angular.module('fabSpeedDialDemoMoreOptions', ['ngMaterial'])
    .controller('DemoCtrl', function($scope, $mdDialog, $timeout) {
      var self = this;
 
      self.hidden = false;
      self.isOpen = false;
      self.hover = false;
 
      // On opening, add a delayed property which shows tooltips after the speed dial has opened
      // so that they have the proper position; if closing, immediately hide the tooltips
      $scope.$watch('demo.isOpen', function(isOpen) {
        if (isOpen) {
          $timeout(function() {
            $scope.tooltipVisible = self.isOpen;
          }, 600);
        } else {
          $scope.tooltipVisible = self.isOpen;
        }
      });
 
      self.items = [
        { name: "Twitter", icon: "assets/angular-material-assets/img/icons/twitter.svg", direction: "bottom" },
        { name: "Facebook", icon: "assets/angular-material-assets/img/icons/facebook.svg", direction: "top" },
        { name: "Google Hangout", icon: "assets/angular-material-assets/img/icons/hangout.svg", direction: "bottom" }
      ];
 
      self.openDialog = function($event, item) {
        // Show the dialog
        $mdDialog.show({
          clickOutsideToClose: true,
          controller: function($mdDialog) {
            // Save the clicked item
            this.item = item;
 
            // Setup some handlers
            this.close = function() {
              $mdDialog.cancel();
            };
            this.submit = function() {
              $mdDialog.hide();
            };
          },
          controllerAs: 'dialog',
          templateUrl: 'dialog.html',
          targetEvent: $event,
            parent: angular.element(document.body),
            
        });
      }
    });
})();