I have created a child component which has a method I want to invoke.
When I invoke this method it only fires the console.log() line, it will not set the test property??
Below is the quick start Angular app with my changes.
Parent
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();
    }
}
Child
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';
    }
}
How can I set the test property as well?
 
     
     
     
     
     
     
     
    



 
     
     
     
    