Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143868 | Apr 8,2019 03:17 PM UTC | Apr 16,2019 12:41 PM UTC | Angular - EJ 2 | 5 |
![]() |
Tags: ColorPicker |
<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';
//..
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.