I'm trying to dynamically populate an array in Angular2. Below is my
import { Component } from '@angular/core';
@Component({
selector: 'pm-app',
templateUrl: 'app/app.component.html'
})
export class AppComponent {
ngOnInit(): void {
let numbers: number[] = [];
for (var i=1; i <= 9; i++) {
numbers.push(i);
}
}
}
Below is the HTML content:
<div id="numbers-frame">
<div class="well">
<div *ngFor="let number of numbers; let i = index">
{{i}} {{number}}
</div>
</div>
</div>
I'm not getting any output at all. Can anyone please tell what am I doing wrong in this? Thanks.