Skip to content

Instantly share code, notes, and snippets.

@afirdousi
Last active July 7, 2017 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afirdousi/72aa902556b84e0c83e87c6a1ec3aa40 to your computer and use it in GitHub Desktop.
Save afirdousi/72aa902556b84e0c83e87c6a1ec3aa40 to your computer and use it in GitHub Desktop.
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