mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-11 05:13:02 -05:00
22 lines
477 B
TypeScript
22 lines
477 B
TypeScript
import { NgFor } from '@angular/common';
|
|
import { Component } from '@angular/core';
|
|
|
|
@Component({
|
|
standalone: true,
|
|
imports: [NgFor],
|
|
selector: 'app-root',
|
|
template: `
|
|
<div *ngFor="let person of persons; let index = index">
|
|
{{ heavyComputation(person, index) }}
|
|
</div>
|
|
`,
|
|
})
|
|
export class AppComponent {
|
|
persons = ['toto', 'jack'];
|
|
|
|
heavyComputation(name: string, index: number) {
|
|
// very heavy computation
|
|
return `${name} - ${index}`;
|
|
}
|
|
}
|