<h4>Choose a color</h4>
<button #flatbtn ejs-button id="flatbtn" cssClass="e-small e-flat e-resetbtn" (click)="btnClick() ">Reset</button>
<input #colorpicker ejs-colorpicker id='color-picker' type='color' (open)="Open($event)" /> |
export class AppComponent {
@ViewChild('flatbtn')
public flatbtn: ButtonComponent;
@ViewChild("colorpicker")
public colorpicker: ColorPickerComponent;
public Open(args: OpenEventArgs): void {
var applyBtn = (args.element.parentElement).querySelector('.e-ctrl-btn') as HTMLElement;
applyBtn.appendChild(this.flatbtn.element);
this.flatbtn.element.style.display = "inline";
}
btnClick() {
this.colorpicker.value = "#008000";
/** Closing color picker popup by manual click */
(this.flatbtn.element.previousSibling as HTMLElement).click();
}
} |
<input #colorpicker ejs-colorpicker id='color-picker' [value]="colorValue" type='color' (open)="Open($event)" /> |
export class AppComponent {
public colorValue: string = '#0db1e7';
//..
} |