Thanks Tommertom I finally found a solution using (click) event binding.
I did not went through that at first because it is more hacky than using renderer2 for detecting outside clicks.
I wrap a (click)
event on the ion-content
and the ion-header
to detect all clicks and execute unselect()
.
unselect(e) {
if (this.button.nativeElement.contains(e.target)) return
this.isSelected = false
}
On my button I simple execute my toggle function
toggleSelect() {
this.isSelected = !this.isSelected
}