Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import { Component, Input } from '@angular/core';
@Component({
selector: 'custom-button',
templateUrl: 'src/custom-button.component.html',
styleUrls: ['src/custom-button.component.css']
})
export class CustomButton {
classes: string;
private _disabled : boolean;
private _text : string;
private _state : string;
private _alert : string;
private _size : string;
@Input()
get disabled(): boolean{ return this._disabled; }
set disabled(v){ this._disabled = v; }
@Input()
get text(): boolean{ return this._text; }
set text(v){ this._text = v; }
@Input()
get state(): string{ return this._state; }
set state(v){
if( v === 'primary'){
this.classes = 'blue';
} else if ( v === 'secondary') {
this.classes = 'white';
} else {
this.classes = '';
}
}
@Input()
get alert(): boolean{ return this._alert; }
set alert(v){ this._alert = v; }
@Input()
get size(): boolean{ return this._size; }
set size(v){ this._size = v; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment