Skip to content

Instantly share code, notes, and snippets.

@umairhm
Last active July 6, 2020 00:35
Show Gist options
  • Save umairhm/1fc6d783ce67668241ad90bba6a111f1 to your computer and use it in GitHub Desktop.
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
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>;
}
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