I'm new with KO and KO components.
I currently have a custom-component.js, which perfectly works, to style all inputs of our project.
However, I'd like to get the exact same component working for textareas.
Currently, the template: part of this component looks like :
viewModel: function (params) {
/* */
template: '<span data-bind="template: { afterRender: afterRender }">' +
'<label class="custom-label" data-bind="css:{\'custom-label-active\':focused}, text:label"></label>' +
'<input class="form-control" type="text" data-bind="enable: enable, valueUpdate: \'input\', css:{\'custom-label-input\':focused}, attr:{placeholder:label, id:id, type: type}, event:{focus:focus,blur:blur},value:value"/>' +
'</span>'
});
How should I update it to make it work for textareas too ?
I tried to add a default parameter like this :
this.element = (params.element == undefined || params.element == null) ? 'input' : params.element
but I'm not sure how to update my markdown ?
Should I just replace '<input' by something like '<' + self.element + '...>'
What about the valueUpdate ? (I'm very new to all of this, sorry if it's a dumb question)
Thank you