mardi 3 mars 2020

Remove a particular element in session storage angular8

I have a list of directions namely

countryList = ["South","East","West"]

shown as mat-checkbox. So when user selects a particular direction, I tried to store the same in session storage

 checkBoxClicked(list, event) {          
        if (event.checked) {
        sessionStorage.setItem("TestingSelectedPages",JSON.stringify({ 'Countries': list}));   

        }
            else {
                   //How to remove the same ???
             }

        }

For example, if the Session storage value is like this enter image description here

I mean , if I uncheck a particular element, (Say , "South"), how to remove only South from the list and keep the others in session storage.




Aucun commentaire:

Enregistrer un commentaire