Currently I am using document.getElementById
to fetch the exact checkbox that needs to be checked.
Here is the code:
setTimeout(function () {
this.tradeids = JSON.parse(sessionStorage.getItem('tradeids'));
var x;
for (let objtrade of this.tradeids) {
x = document.getElementById(objtrade);
x.checked = true;
}
this.programIds = JSON.parse(sessionStorage.getItem('programIds'));
var y;
for (let objprogram of this.programIds) {
x = document.getElementById(objprogram);
x.checked = true;
}
}, 100);
}
How can I replace document.getElementbyId
with elementRef
or any other typescript function.
FYI,
I did use elementRef
using querySelector
but the log says that nativeElement
is undefined.