am trying to create select option dynamically using Renderer2. at present am not able to create <Select></Select>
element. but i can see able to see <options>
are created. due to some concerns am not allowed to share all snippets. apologizes for that.
Issue is: as its not creating select element. its just simply showing first element of array. i could get all elements when i console it in ngOniti()
no other console errors as well.
PFA.
kindly someone help me on this and point me right direction. if possible pls share working demo. after spend so many hours i found this only .
arr= ["AAA", "BBB", "CCC", "DDD", "EEE"];
const select = this._rend.createElement('select');
select.name = name;
var option = this._rend.createElement('option');
this._rend.appendChild(select, option);
this._rend.appendChild(option, document.createTextNode(''));
arr.forEach( aaaa=>{
option = this._rend.createElement('option');
this._rend.appendChild(option, document.createTextNode(aaaa));
if (aaaa === value)
option.selected = true;
this._rend.appendChild(select, option);
})
Note: kindly share any other better solutions if mine is not at all good one.
Thank you so much every one.