title: How to call the method from child component to parent component in Angular
body: <p>I have one method in Child component like below:</p>
  <pre><code>showAcknowledgement() {
      this.noticeService.getNotice(ConstUrls.NoticeManagement.GetUserNotice).subscribe((data: any) =&gt; {
        data.data.filter((res: any) =&gt; {
        if (data.isSuccessful === true) {
          this.noticeText = res.noticeText;
          this.noticeAttachment = res.noticeAttachement;
          this.noticeCode = res.noticeCode;
        } else if (data.isSuccessful === false) {
          this.message = [{ field: &quot;&quot;, message: data.message[0].message }];
          this.objError = this.message;
          this.showError = true;
          window.scrollTo({ top: 0, behavior: 'smooth' });
        }
      })
      });
    }
  </code></pre>
  <p>I need to call this method in parent component inside ngOnInit() because while page loading I need to call that method. I tried like below but its not working</p>
  <p>Parent HTML:</p>
  <pre><code>&lt;app-acknowledge-notice-modal #child&gt;&lt;/app-acknowledge-notice-modal&gt;
  </code></pre>
  <p>Parent TS:</p>
  <pre><code>@ViewChild(AcknowledgeNoticeModalComponent, {static : true}) child : AcknowledgeNoticeModalComponent;
  
  
  ngOnInit() {
      this.child.showAcknowledgement();
  }
  </code></pre>