phenomnomnominal / angular-2-local-storage

LocalStorageService for Angular 2 with the same API as angular-local-storage
MIT License
93 stars 49 forks source link

setItem$ Observable firing in component but not in directive #58

Closed StevenFewster closed 6 years ago

StevenFewster commented 6 years ago

I'm setting a local storage variable by toggling a button. The subscribe is working as expected in the component it's being triggered from, but fires only the first time in the directive, subsequent changes are not picked up.

I feel like this might be an Angular thing, or how I've architected it, but just wondering if subscribing in directives is a known issue.

StevenFewster commented 6 years ago

Problem was mine. setItem$ returns what's changed rather than the whole localStore and that was causing my observer to unsubscribe when it failed.

Sorry and thanks for all your work on this project.