corregido error popover

This commit is contained in:
Dani Herrero 2017-07-05 14:01:03 +02:00
parent e4e01c4970
commit 53af148def
1 changed files with 6 additions and 5 deletions

View File

@ -136,13 +136,14 @@ export class Popover {
}
this._checkOpens();
}
hideOthers(id) {
hideChilds(id) {
let popovers = this.document.querySelectorAll('*[id^="popover-"]');
let idNumber = parseInt(id.split('-')[1], 10);
popovers.forEach(
val => {
if (angular.element(val).attr('id') != id) {
let valId = angular.element(val).attr('id');
if (parseInt(valId.split('-')[1], 10) > idNumber)
this._removeElement(val);
}
}
);
this._checkOpens();
@ -169,7 +170,7 @@ export class Popover {
onDocMouseDown(event) {
let targetId = this._findParent(event.target);
if (targetId) {
this.hideOthers(targetId);
this.hideChilds(targetId);
} else {
this.hideAll();
}
@ -178,7 +179,7 @@ export class Popover {
if (event.keyCode === 27) {
let targetId = this._findParent(this.latTarget);
if (targetId) {
this.hideOthers(targetId);
this.hideChilds(targetId);
} else {
this.hideAll();
}