For some reason I can't get the value of the list element in the html despite using document.getElementByID and it has the same id. It claims that the element is undefined. Here is the code:
fileupload.component.ts:
ngOnInit() {
var x = document.getElementById('lemons');
if(x){
console.log('it does exits')
x.addEventListener('click', function(e:any){
console.log(x.innerHTML);
});
}
}
fileupload.component.html:
<div class="row" id="filesDisplay">
<div class="col-md-4" id="files">
<li *ngFor="let child of tree" id="lemons">
{{child}}
</li>
</div>
template-variablewithViewChildren, bindclicklistner directly using(click)="myEvent($event)"<li>element (representing a separate element oftreelist) has the same id -'lemons'.