mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-12 05:43:03 -05:00
feat(move): move lib
This commit is contained in:
36
apps/angular/pipe-hard/src/app/app.component.ts
Normal file
36
apps/angular/pipe-hard/src/app/app.component.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { NgFor } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { PersonUtils } from './person.utils';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [NgFor],
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<div *ngFor="let activity of activities">
|
||||
{{ activity.name }} :
|
||||
<div
|
||||
*ngFor="let person of persons; let index = index; let isFirst = first">
|
||||
{{ showName(person.name, index) }}
|
||||
{{ isAllowed(person.age, isFirst, activity.minimumAge) }}
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
})
|
||||
export class AppComponent {
|
||||
persons = [
|
||||
{ name: 'Toto', age: 10 },
|
||||
{ name: 'Jack', age: 15 },
|
||||
{ name: 'John', age: 30 },
|
||||
];
|
||||
|
||||
activities = [
|
||||
{ name: 'biking', minimumAge: 12 },
|
||||
{ name: 'hiking', minimumAge: 25 },
|
||||
{ name: 'dancing', minimumAge: 1 },
|
||||
];
|
||||
|
||||
showName = PersonUtils.showName;
|
||||
|
||||
isAllowed = PersonUtils.isAllowed;
|
||||
}
|
||||
Reference in New Issue
Block a user