Skip to content

Instantly share code, notes, and snippets.

@rjmccluskey
rjmccluskey / example-component.ts
Last active October 17, 2021 04:47
Angular 2 Input with TypeScript property (getter and setter)
import { Component, Input } from '@angular/core';
@Component({
selector: 'example',
template: `{{data}}` // getting `data` in the template will call the getter method!
})
export class ExampleCoponent {
private dataInternal: number;
@Input() set data(data: number) {