Category : session-storage

I have a text input field in a components html: <input type="text" (input)="myFunc(‘test’, $event.target.value)"> This hits a function inside a component. The function calls a session storage service, which results in sessionStorage.setItem(key, val) As you type, the value in session storage is updated to reflect the change. This works perfectly fine in Chrome, however in ..

Read more

The following code works if I make a single change: replacing localStorage with sessionStorage. Can someone explain why? To my knowledge, they are identical in functionality and differ only in that sessionStorage is limited to a tab. read(key: string): any { const item = localStorage.getItem(key); return JSON.parse(item); } write(key: string, value: any): void { localStorage.setItem(`${key}`, ..

Read more

I want to save Phone number and mail ID in session storage/local storage in Angular. I have written code to collect details. But I have no idea regarding the next step. <h2>Welcome User!!!</h2> <form class="container" action="/product"> <div> <label for="mail"><b>Email-ID</b></label> <input type="text" placeholder="Enter mail ID" name="mail" required> <label for="psw"><b>Phone Number</b></label> <input type="text" placeholder="Enter Phone Number" name="phone" ..

Read more

I have a SessionStorage item set with the following values: key : state-allRequestsandResponses value : “{“first”:30,”rows”:10,”sortField”:”isWorkComplete”,”sortOrder”:1}” I want to obtain the value for first for example and change the value of 30 to say 40. I’m having real difficulty with using sessionStorage.setItem to change this value. Can anybody give an example of how to change ..

Read more