Within the document, there is a select element as shown below:
<select tabindex="1" size="5" name="abc" multiple>
<option value>Select a value.</option>
<option value>option 1</option>
<option value>option 2</option>
<option value>option 3</option>
<option value>option 4</option>
</select>
In JavaScript/TypeScript, I can access it like so:
let select = document.querySelector("select").children;
for(let i= 0; i<select.length; i++) {
console.log(select[i].innerHTML);
}
However, when attempting the same in an Angular 2 class, the result differs:
<select tabindex="1" size="5" name="abc" multiple>
<option value>Select a value.</option>
<option value>__</option>
<option value></option>
</select>
This discrepancy could be due to Angular 2 executing before the full document loads. Despite trying to run scripts at various points such as
window.onload and $(document).ready(...);
The options are still not being retrieved. Any suggestions?