Skip to content Skip to sidebar Skip to footer

Set Css Variable With Html5 Color Picker In Angular 5?

I have an Angular 5 application with items styled in CSS with CSS variables, as in --color-links: #0000ff; a { color: var(--color-links); } So, I was trying to wire up an HTML5 co

Solution 1:

To get the selected value from the picker use ngModelChange event with ngModel directive.

<input type="color"
               id="color-picker-link"
               (ngModelChange)="setColor($event)"
               [ngModel]="linkColor">

setColor(newColor) {
  console.log('value', newColor);
  this.linkColor = newColor;
}

Post a Comment for "Set Css Variable With Html5 Color Picker In Angular 5?"