i have a modal for show notification in angular 9 .
i have a button for show or hide modal and it's worked find , but i need when click on the other place of page ( not show/hide button ) If the modal is on show, hide it .
this is Demo .
html :
    <div class="header">
 <button (click)="toggleFunction()">show</button>
<div class="showButton" id="showNotification">
  <span>this is test</span>
</div>
</div>
ts :
   export class TopeheaderComponent implements OnInit {
  constructor() { }
  ngOnInit() {
  }
    toggleFunction() {
        let element = document.getElementById('showNotification');
        if (element.style.display === '' || element.style.display === 'none') {
            element.style.display = 'block';
        } else if (element.style.display === 'block') {
            element.style.display = 'none';
        }
    }
}
how can i solve this problem ?
 
     
    