I have the following function in my component:
onProductSelect(e){
var attrs = document.getElementById('firstAttr');
return this.groupComponentSvs.getProduct(e.target.value)
.subscribe(
selectProduct=>{
this.selectProduct=selectProduct;
var select = "<select class='form-control' id='"+ selectProduct.attribute +"' (change)='selectNextAttr($event)' name='selectProd'>";
console.log(select);
select+= '<option value="0">Select</option>';
for (var i=0; i<selectProduct.values.length; i++) {
select+= '<option value='+ selectProduct.values[i]+ '>'+ selectProduct.values[i] +'</option>';
}
select+='</select>' ;
attrs.innerHTML = '<div id=attr_'+ selectProduct.attribute +'>'+ select +'</div>';
error=>this.errorMessage = <any>error
}
)
}
selectNextAttr(attr, val){
console.log("this is a test");
}
I am able to insert the select menu in my html page but the change event is not being triggered with I select an item. Can someone let me know why this is happening?
Thanks