LocalStorage Observable Error: 'Decorators are not valid here.'
See original GitHub issueLoving the package so far! Having just a small issue with the LocalStorage
decorator.
Attempting to put @LocalStorage('value')
within the class (or outside of it) will cause an error.
I looked further into the issue, and saw #https://github.com/Microsoft/TypeScript/issues/8257, so it could possibly be just an issue with typescript compilation?
(feel free to close out the thread if not a valid issue)
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"Decorators are not valid here" for methods inside an ... - GitHub
Error TS1206 : Decorators are not valid here on a non-top level class # ... LocalStorage Observable Error: 'Decorators are not valid here....
Read more >ts1206 decorators are not valid here, Angular 2 - Stack Overflow
This error came to me when I used angular routing and defined routes after @NgModule decorator. We need to define routes or any...
Read more >angular/angular - Gitter
I'm getting this error when requesting from google places api. No 'Access-Control-Allow-Origin' header is present on the requested resource.
Read more >Implementing Persistency over localStorage - SurviveJS
It is easy to end up in a situation where localStorage contains invalid data due to changes made to the data model. This...
Read more >Managing App State | Aurelia
The decorator will attempt to call stateChanged(newState, oldState) when no settings are passed, a function is used or an object settings is used...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nop it shouldn’t detect changes, you need to call
this.storage.store(...)
or assign a bound variablethis.anAttribute = 'hello'
.Btw, the library includes a cache system, so if you change a value in the storage during a test session, this value will not change in the app. You need to refresh the page after any direct change in the localStorage/sessionStorage to ensure that the lib takes the new value.
Edit: Since v1.4 this is not true anymore.
Lol, it’s working now.
I figured out my issue. I was changing values through the browser dev tools, to see if it observed the changes (it didn’t). But once I implemented some tests using your packages methods, I saw that it did observe the changes. Good to know that it can only detect changes through your methods, and was confused as to if I did something wrong on my end.
Thanks again!