I have a web page with a loop calling a component like 10 times. I pass data to my component and it works. But here's my problem. In my component I want print the object value but it's always empty.
In my component HTML:
<div>
Name: {{ teamInfo.name }}
</div>
<div>
<mat-table [dataSource]="List" class="mat-elevation-z8">
<ng-container matColumnDef="ronde">
<mat-header-cell *matHeaderCellDef matTooltip="Ronde">rd</mat-header-cell>
<mat-cell *matCellDef="let element">{{ element.ronde }}</mat-cell>
<mat-footer-cell *matFooterCellDef> </mat-footer-cell>
</ng-container>
</mat-table>
</div>
Everything works fine for the mat-table because this data is received in the Init code.
To help the code to be clear, I go directly without database access.
the .ts file:
export class MyComponent implements OnInit {
teamInfo: TeamObject;
@Input() List: DraftList;
constructor() {}
ngOnInit() {
console.log("DraftList", this.List);
this.getConcessionInfo();
}
public getConcessionInfo() {
this.teamInfo.name ="TeamName";
console.log(this.teamInfo.name);
}
}
The problem is: I have my code working correctly in the .ts code (Console log have data, like this one: console.log(this.teamInfo.name); )
But in HTML component , this line is empty : Name: {{ teamInfo.name }}
Data receive in the @Input are print correctly in the HTML. I'm new in this king of programming. Can someone see why my variable is not print in the HTML ?
Thanks
getConcessionInfoan async function?