2

I'm a newbie with Angular 6.I have a few problems in call method another component. I have 3 components like this

  • app.component.ts
  • com.header.ts
  • app.component-user-profile.ts

In app.component.ts I include com.header.ts

**com.header.html**
<com-header>{{fullName}}</com-header>
**com.header.ts**
private onGetUserInfo(){
   this.fullName = "My FullName"
}
public onTest(){
  this.onGetUserInfo();
}
**app.component-user-profile.html**
<com-header>{{fullName}}</com-header><!--Without Include-->
<button (click)="onTest();">call method form com.header.ts</button>
app.component-user-profile.ts
private onTest(){
   //call method form com.header.ts
    ????
}

How to call method from call method form com.header.ts without include?
<com-header></com-header><!--Without Include-->

Thank you

Mohammad Daliri
  • 1,370
  • 6
  • 20
  • 43
allex
  • 21
  • 1

0 Answers0