Last active
July 7, 2017 07:43
-
-
Save afirdousi/72aa902556b84e0c83e87c6a1ec3aa40 to your computer and use it in GitHub Desktop.
This file contains 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'; | |
@Component({ | |
selector: 'custom-input', | |
templateUrl: 'src/custom-input.component.html', | |
styleUrls: ['src/custom-input.component.css'] | |
}) | |
export class CustomInput { | |
classes: string; | |
private _disabled : boolean; | |
private _placeholder : string; | |
private _label : string; | |
private _state : string; | |
private _alert : string; | |
@Input() | |
get disabled(): boolean{ return this._disabled; } | |
set disabled(v){ this._disabled = v; } | |
@Input() | |
get _placeholder(): string{ return this._placeholder; } | |
set _placeholder(v){ this._placeholder = v; } | |
@Input() | |
get label(): string{ return this._label; } | |
set label(v){ this._label = v; } | |
@Input() | |
get state(): string{ return this._state; } | |
set state(v){ | |
if( v === 'success'){ | |
this.classes = 'green'; | |
} else if ( v === 'failure') { | |
this.classes = 'red'; | |
} else { | |
this.classes = ''; | |
} | |
} | |
@Input() | |
get alert(): boolean{ return this._alert; } | |
set alert(v){ this._alert = v; } | |
constructor( ){ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment