I have the following html:
<!-- See click event -->
<div *ngFor="let tabComp of tabCompArr" (click)="selectTab(tabComp)">
{{ tabComp.title }}
</div>
And in component:
ngOnInit() {
this.tabCompArr = [...]
}
selectTab( selectedTab ) {
// this changes tabCompArr property. WHY?
selectedTab.active = true;
}
Why setting selectedTab.active
to true, changes the tabCompArr
property? Isn't the selectedTab
a local variable?