Here is my code. https://stackblitz.com/edit/angular-tq2vaa
constructor(private host: ElementRef) {
}
get element() {
return this.host.nativeElement;
}
private editModeHandler() {
const clickOutside$ = fromEvent(document, 'click').pipe(
filter(({ target }) => {
console.log('parent', this.element, 'child', target)
const ans = this.element.contains(target) === false
console.log(ans)
return ans
}),
take(1)
)
}
This is what it prints in the console. As you can see, app-editable-component contains h3 which is the target but why ans is true???

