0
votes

I have saved some data in sessionStorage (a large JSON response from ajax) in EmberJS, and wanted to know if there was a way to access that directly in template handlebars. If not, what would be my alternatives? I have tried {{sessionStorage.getItem("data"}} in template but it gives me an error saying "Expecting 'ID', got 'INVALID'".

1
Oh that's just a typo, let me correct that. It's not in the code - Muhammad Hamza

1 Answers

0
votes

You should set the item in sessionStorage to a variable in your component.js like this:

init:function(){
  this.set('sessionStorageData', sessionStorage.getItem('data'));
}

and use it in your hbs like this:

{{sessionStorageData}}