Вызовите метод дочернего компонента из родительского класса - Angular

Я создал дочерний компонент, у которого есть метод, который я хочу вызвать.

Когда я вызываю этот метод, он только запускаетconsole.log() линия, он не установитtest имущество??

Ниже приведен краткий обзор приложения Angular с моими изменениями.

родитель

import { Component } from '@angular/core';
import { NotifyComponent }  from './notify.component';

@Component({
    selector: 'my-app',
    template:
    `
    <button (click)="submit()">Call Child Component Method</button>
    `
})
export class AppComponent {
    private notify: NotifyComponent;

    constructor() { 
      this.notify = new NotifyComponent();
    }

    submit(): void {
        // execute child component method
        notify.callMethod();
    }
}

ребенок

import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'notify',
    template: '<h3>Notify {{test}}</h3>'
})
export class NotifyComponent implements OnInit {
   test:string; 
   constructor() { }

    ngOnInit() { }

    callMethod(): void {
        console.log('successfully executed.');
        this.test = 'Me';
    }
}

Как я могу установитьtest собственность тоже?

Ответы на вопрос(4)

Ваш ответ на вопрос