Within my Angular project, I am attempting to retrieve the value from
<td [innerHTML]='rupee.replaceHTML' #term></td>
and assign it to the variable newdata.
Exploring further into the functionality, there are 2 buttons named change
and concourse
. Upon clicking the concourse
button, the value within the HTML below will be altered. My goal is to capture this updated value in the variable newdata
using localStorage
for future access.
How can I go about retrieving the HTML value and storing it in new_data
?
.html file
<mat-list-item>New Life</mat-list-item>
<mat-list class="textFields">
<table>
<tr>
<td [innerHTML]='rupee.replaceHTML' #term></td> ---> Access the value here
</tr>
</table>
</mat-list>
//button
<button mat-raised-button type='button' (click)='concourse(kada, term)'>Confirm
component.ts
export class Pinky {
@ViewChild('term') editElem!: ElementRef<HTMLTableDataCellElement>;
//button function
concourse(rec: FillData, nada: HTMLTableDataCellElement) {
const { a,b,c,d } = rec;
let maan= nada.innerText;
localStorage.setItem('FillData', JSON.stringify(rec));
var new_data = JSON.parse(localStorage.getItem('FillData') || '{}') as FillData
-------------------//Can I access #term value here?-------------------------
new_data.{{?}}= maan; ----------> Assign the value here ?
localStorage.setItem('FillData', JSON.stringify(new_data));
}
Interface
export interface DraneMan {
maan:string;
}