This is from my parent component html.
<div class="section graph ltr">
<campaign-graph
(getLeads)="getLeadsForCampaign($event)"
[campaign]="campaign"
[leads]="campaign.leadTotal"
[leadsCount]="leadsSum"
[openLeadsCount]="openLeadsCountForCampaign"
[averagePosition]="averagePositionForCampaign"
[difference1stPlace]="difference1stPlaceForCampaign"
></campaign-graph>
</div>
"campaign-graph" is the child, all of the field are getting fine in the child, but I am not entering "getLeadsForCampaign" on the parent.
why?
Parent:
getLeadsForCampaign(campagin) {
this.toChild = campagin;
if (this.leadsSum > 0) {
this.averagePositionForCampaign = this.leadsSum;
}
}
child:
@Input() leads: number;
@Input() leadsCount: number;
@Input() openLeadsCount: number;
@Input() averagePosition: number;
@Input() difference1stPlace: number;
@Input() campaign: Campaign;
@Output() getLeads: EventEmitter<Campaign> = new EventEmitter<Campaign>();
current: Campaign;
constructor(
public moneyPipeC: RubikShekelPipe,
private currentRouterC: ActivatedRoute,
private readonly _exportServiceC: ExportService,
private readonly _apiC: BestiapiService,
_utilsC: UtilitiesService,
private translate: TranslateService,
private http: HttpClient,
private authC: AuthService
) {
super(currentRouterC, moneyPipeC, _exportServiceC);
}
fromParent(Campaign) {
this.getLeads.emit(Campaign);
}
ngOnInit() {
this.fromParent(this.current);
this.dayFilter = EditField.optionFieldBuilder('agencies', this.translate.instant('CAMPAIGNS.FILTER_DAYS.TITLE'), []);
}