I am trying to display an array's data (populated in chat.component)..
public matchesList = [];
loadMatches() {
...
if (result.success) {
this.matchesList = result.matches_list.split(',');
console.log(this.matchesList);
}
}
..in chat.component.html..
<div class="matchesList" *ngFor="let match of matchesList">
<p>{{match}}</p>
</div>
.. without any luck!
The console.log() shows me that the array is populated correctly: (3) ["3", "5", "6"].
loadMatches() is called from another component home.component..
import { ChatComponent } from '../chat/chat.component';
@Component({
providers: [ChatComponent],
...
})
loadChatViewData() {
this.chatComp.loadMatches();
}
<a class="nav-link" (click)="loadChatViewData()"></a>
Why isn't matchesList's data accessible in chat.component.html ?
Thank you!
providers:[...]. That is used for services.