I'm working with Angular and I have a TypeScript variable initialized to 0. However, when trying to increment it using *ngFor in my .ts file, the increment is not happening (even though the loop is running correctly).
my-page.html
<div *ngFor="let item of sn">
{{myNumber++}}
</div>
my-page.ts
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-stock-modal-one',
templateUrl: './my-page.html',
styleUrls: ['./my-page.scss'],
})
export class MyPage implements OnInit {
myNumber = 0;
sn = ['a', 'wefwef', 'qwqw', 'qw', 'qw'];
constructor() {
}
ngOnInit() {
}
}
Can anyone help me figure out what I missed?