src/message/popoverComponent.js
function PopoverController($scope) {
  /**
   * The state of the popover (displayed or not)
   * @type {boolean}
   */
  this.shown = false;

  /**
   * @type {?JQuery}
   */
  this.anchorElm = null;

  /**
   * @type {?JQuery}
   */
  this.bodyElm = null;

  const clickHandler = (clickEvent) => {
    if (!this.anchorElm) {
      throw new Error('Missing anchorElm');
    }
    if (!this.bodyElm) {
      throw new Error('Missing bodyElm');
    }
    if (this.anchorElm[0] !== clickEvent.target &&
      this.bodyElm.parent()[0] !== clickEvent.target &&
      this.bodyElm.parent().find(clickEvent.target).length === 0 && this.shown) {
      this.dismissPopover();
    }
  };

  document.body.addEventListener('click', clickHandler);

  $scope.$on('$destroy', () => {
    document.body.removeEventListener('click', clickHandler);
  });
}
function PopoverController($scope) {
  /**
   * The state of the popover (displayed or not)
   * @type {boolean}
   */
  this.shown = false;

  /**
   * @type {?JQuery}
   */
  this.anchorElm = null;

  /**
   * @type {?JQuery}
   */
  this.bodyElm = null;

  const clickHandler = (clickEvent) => {
    if (!this.anchorElm) {
      throw new Error('Missing anchorElm');
    }
    if (!this.bodyElm) {
      throw new Error('Missing bodyElm');
    }
    if (this.anchorElm[0] !== clickEvent.target &&
      this.bodyElm.parent()[0] !== clickEvent.target &&
      this.bodyElm.parent().find(clickEvent.target).length === 0 && this.shown) {
      this.dismissPopover();
    }
  };

  document.body.addEventListener('click', clickHandler);

  $scope.$on('$destroy', () => {
    document.body.removeEventListener('click', clickHandler);
  });
}
function PopoverController ( $scope ) { /**
   * The state of the popover (displayed or not)
   * @type {boolean}
   */ this . shown = false ; /**
   * @type {?JQuery}
   */ this . anchorElm = null ; /**
   * @type {?JQuery}
   */ this . bodyElm = null ; const clickHandler = ( clickEvent ) => { if ( ! this . anchorElm ) { throw new Error ( 'Missing anchorElm' ) ; } if ( ! this . bodyElm ) { throw new Error ( 'Missing bodyElm' ) ; } if ( this . anchorElm [ 0 ] !== clickEvent . target && this . bodyElm . parent ( ) [ 0 ] !== clickEvent . target && this . bodyElm . parent ( ) . find ( clickEvent . target ) . length === 0 && this . shown ) { this . dismissPopover ( ) ; } } ; document . body . addEventListener ( 'click' , clickHandler ) ; $scope . $on ( '$destroy' , ( ) => { document . body . removeEventListener ( 'click' , clickHandler ) ; } ) ; }
The controller for the 'popover' directive.
@constructor
@ngInject
@ngdoc controller
@ngname NgeoPopoverController
@param {angular.IScope} $scope Scope.
@private
@hidden
The controller for the popover directive .