Reputation: 1687
I have a "signup" method on app.component.ts class which is being called from "Sign up" link on app.component.html file. It internally calls a service class and some more login in it.
html:
<a (click)="signup($event)">Sign up</a>
ts:
export class AppComponent implements OnInit, OnDestroy {
signup(e: any) {
this.service.signup();
}
}
There is another html/component file which has the same signup link. Is it possible to call AppComponent's signup method directly from the html/component file?
Upvotes: 0
Views: 964
Reputation: 14679
You can call one component method/function in below conditions
Better to use shared service for your requirement, where common function are together.
Upvotes: 1