Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
How to get value on change or on input method in angular2 using bootstrap-colorpicker?

I am using angular-cli and bootstrap-colorpicker. I want to get the value while picking up a color from the colorpicker onchange / oninput method.

here is my html code:

<div id="cp2" class="input-group colorpicker-component">
  <input id="colorInput" type="text" value="#00AABB" class="form-control textedit" data-type="color"  (input)="testevent($event)" />
  <span class="input-group-addon"><i></i></span>
</div>

in ts file:

testevent(event){
    console.log(event.target.value);
}

This function works when I make an input directly in the input type. Using jQuery method onchange or oninput I am able to get value. But I want to use angular2 way.

Please suggest me to solve this situation.

Thanks and Regards

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use [(ngModel)] just as anyother input

  <input id="colorInput" type="text" 
     [(ngModel)]="colorCode" 
      value="#00AABB" 
      class="form-control textedit" 
      data-type="color"  (change)="test()" />


test(){
    console.log(this.colorCode);
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!