ng2-cache | Client side caching service for Angular2 | Caching library
kandi X-RAY | ng2-cache Summary
kandi X-RAY | ng2-cache Summary
Client side caching service for Angular2
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ng2-cache
ng2-cache Key Features
ng2-cache Examples and Code Snippets
Community Discussions
Trending Discussions on ng2-cache
QUESTION
I am using CacheService with my search screen that contains many dropdown values. It works only if you set the cache for one dropdown , it won't work if you set cache for more than one , even if they have different keys. I think I need to create a new instance of the cache service
example:
...ANSWER
Answered 2018-Sep-07 at 20:32If you just inject your service (or any @Injectable) in the constructor, Angular will walk up the component / module tree and look for providers for your service. It is highly likely that you added your service to the providers array of a module. This will result in a singleton service which is used everywhere you inject this service inside this module.
If you do want to use an independent instance of your service for your component, you can add the service to the providers array of your component, like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ng2-cache
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page