Last active
July 6, 2020 00:35
-
-
Save umairhm/1fc6d783ce67668241ad90bba6a111f1 to your computer and use it in GitHub Desktop.
Example of component that takes arrays as inputs, and renders those arrays using *ngFor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input } from '@angular/core'; | |
import { Person } from './person.interface'; | |
@Component({ | |
selector: 'array-coercion', | |
template: `...` | |
}) | |
export class ArrayCoercionComponent { | |
@Input() strings: Array<string>; | |
@Input() persons: Array<Person>; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Person { | |
name: string; | |
age: number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment