I'm missing something elementary in my attempt to store and retrieve an array in localstorage in my Angular 4 app.
The app retrieves the array from the server into an 'any' typed variable called aToDo as:
{"qoption":"Trap Surveyor (<em>Competency for CM OAP<\/em>)"}
and stored in localstorage by:
localStorage.setItem('aToDo',JSON.stringify(this.aToDo));
It's retrieved from localstorage as:
this.aToDo = JSON.parse(localStorage.getItem('aToDo'));
A console.log of this.aToDo displays:
{"qoption":"Trap Surveyor (<em>Competency for CM OAP<\/em>)"}
But by this stage, things are stuffed as logging this.aToDo.qoption yields 'undefined' and the *ngFor used to list the array's contents generates the damning error:
Error: Cannot find a differ supporting object '{"qoption":"Trap Surveyor (<em>Competency for CM OAP<\/em>)"}' of type 'string'.
Where is my error? Thanks/Tom