Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created May 30, 2019 08:22
Show Gist options
  • Save phenomnomnominal/604e3f38dd534b9710a1d97d36e01389 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/604e3f38dd534b9710a1d97d36e01389 to your computer and use it in GitHub Desktop.
import { Component, Input } from '@angular/core';
import { Value, isBool, isNotNull } from '@trademe/ensure';
@Component({
selector: 'hello'
// ...
})
export class HelloComponent {
private _primary: boolean;
@Input()
public get primary (): boolean {
let val = this._primary;
val = isNotNull(val, 'primary');
return val;
}
public set primary (value: boolean) {
let val = value;
val = isBool(val, 'primary');
this._primary = val;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment