Reputation: 208
I'm having a problem when I enter the form that would be the parent component that automatically loads the methods that the child component has on the OnInit, this adds a bit more load to my parent component
Is there any way that my child component starts when I click a button or otherwise?
Inside my father's html I have the son in this way
<app-solicitud-servicios #solicitud1></app-solicitud-servicios>
Upvotes: 0
Views: 640
Reputation: 61
You can use *ngIf to only show it when some criteria is met. That could be after clicking a button, or whatever you want.
<app-solicitud-servicios *ngIf="buttonWasClicked" #solicitud1></app-solicitud-servicios>
It won't call OnInit in the child until the *ngIf condition is true.
Upvotes: 1