Created
September 18, 2019 20:23
-
-
Save ronnyek/6185fbcae468c6c199b0d763d24e7f42 to your computer and use it in GitHub Desktop.
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 { coerceBooleanProperty } from '@angular/cdk/coercion'; | |
| @Component({ | |
| selector: 'some-component', | |
| template: `` | |
| }) | |
| export class SomeComponent { | |
| private _showLabel: boolean; //set a default val if necessary | |
| @Input() | |
| set showLabel(value: boolean){ | |
| this._showLabel = coerceBooleanProperty(value); | |
| } | |
| get showLabel(): boolean { | |
| return this._showLabel; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment