code: function TimePickerCtrl($scope, $mdDialog, time, autoSwitch, ampm, confirmText, cancelText, $mdMedia) {
  	var self = this;
      this.VIEW_HOURS = 1;
      this.VIEW_MINUTES = 2;
      this.currentView = this.VIEW_HOURS;
      this.time = moment(time);
      this.autoSwitch = !!autoSwitch;
      this.ampm = !!ampm;
      this.confirmText= confirmText ? confirmText :"OK";
      this.cancelText= cancelText ? cancelText :"Cancel";
  
      this.hoursFormat = self.ampm ? "h" : "H";
      this.minutesFormat = "mm";
  
      this.clockHours = parseInt(this.time.format(this.hoursFormat));
      this.clockMinutes = parseInt(this.time.format(this.minutesFormat));
  
      $scope.$mdMedia = $mdMedia;
  	
      this.switchView = function() {
          self.currentView = self.currentView == self.VIEW_HOURS ? self.VIEW_MINUTES : self.VIEW_HOURS;
  	};
      
  	this.setAM = function() {
          if(self.time.hours() >= 12)
              self.time.hour(self.time.hour() - 12);
  	};
      
      this.setPM = function() {
          if(self.time.hours() < 12)
              self.time.hour(self.time.hour() + 12);
  	};
      
      this.cancel = function() {
          $mdDialog.cancel();
      };
  
      this.confirm = function() {
          $mdDialog.hide(this.time.toDate());
      };
  }
docs: /* global moment, angular