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
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);
}