Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created September 13, 2018 10:44
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 lydemann/d0ddb6e195950e5c6b1789cb6621f4bf to your computer and use it in GitHub Desktop.
Save lydemann/d0ddb6e195950e5c6b1789cb6621f4bf to your computer and use it in GitHub Desktop.
import { Input } from '@angular/core';
import { ButtonParentComponent } from '@app/shared/buttons/button-parent-component';
export abstract class ButtonChildComponent<ButtonTypes = any> {
@Input() public parent: ButtonParentComponent<ButtonTypes>;
public get iconButton() {
return this.parent.iconButton;
}
public get type() {
return this.parent.type;
}
public get text() {
return this.parent.text;
}
public get disabled() {
return this.parent.disabled;
}
public get buttonStyle(): { [key: string]: string } {
return this.parent.buttonStyle;
}
public get buttonClass(): { [key: string]: boolean } {
return this.parent.buttonClass;
}
public clicked() {
this.parent.clicked.emit();
}
public onClick() {
if (!this.disabled) {
this.clicked();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment