This has been driving me nuts.
got a hidden input box as follows
<input type='hidden' id='iFrameDrivenImageValue' value='n/a'>
And I'm trying to read its value from .ts to submit to DB.
But cannot compile the TS. Stopped by an error that reads like this:
ERROR in /Users/...component.ts (4773,89): Property 'value' does not exist on type 'HTMLElement'.
tried
<HTMLInputElement>document.getElementById("iFrameDrivenImageValue").value;
tried
<HTMLInputElement>document.getElementById("iFrameDrivenImageValue")?.value;
tried
theForm.form.controls['iFrameDrivenImageValue'].value;
When I step thru with the chrome's debugger, the console got no problems spitting out the value of document.getElementById("iFrameDrivenImageValue").value as 'n/a'.
How can I get TS also see the same thing? Or at least cool it off so I can compile the darn script?
Someone may ask why not go banana in the box and bind it two-way? Well, the reason I am flirting with this mickey mouse way of trying to get to the value is because Angular does not see the change within an ngForm input field (when an iFrame script updates the value within that input field ). Go Figure!
As far as Angular is concerned, that iframe driven/changed value within the ngForm is still pristine and the theForm.form.controls is unaware of its recently updaed value.
Since all of these efforts failed, I was forced to try to go old-school way, but cannot get TS compile.
postMessage APIto communicate between the 2 windows when value does get changed. Or use storage events if both are on same domain