Comments (7)
Driver
is only exported in ngforage^4.0.0. Refer to the old API for ngforage^3.0.0.
And it will not save to more than one store. See https://localforage.github.io/localForage/#settings-api-setdriver
If you're using the UMD bundle, you should upgrade to ngforage 4.x as soon as possible - there is a number of bugs in 3.x that have been resolved in 4.x.
from ngforage.
@Alorel
updated to ngforage^4.0.0
from ngforage.
Hm, what version of Typescript are you using?
from ngforage.
Additionally, please create a reproducible example as shown in the bug report issue template
from ngforage.
I updated the Angular to 7, typescript too and now it is working.
I have only one doubt:
in my module I'm inserting like this:
driver: [
Driver.INDEXED_DB,
Driver.LOCAL_STORAGE
]
like that in my call to write or save in the specific component which driver to use, example call.
public setItem (data) {
console.log ('Setting value ...');
try {
this.ngf.setItem ('email', data.email)
.then ((d) => {
console.log ('Value set!');
console.log (d);
})
} catch (e) {
console.log (e);
}
}
example in this insert I want to send to localstorage
from ngforage.
If you want some component to bypass the default priority, you're best off injecting a DedicatedInstanceFactory:
@Component()
export class FooComponent {
private readonly ngf: NgForage;
public constructor(inst: DedicatedInstanceFactory,
private readonly standardNgf: NgForage) {
this.ngf = inst.createNgForage({driver: [Driver.LOCAL_STORAGE]});
}
public async setItem(data: any) {
console.log(`Set to IndexedDB OR localStorage: ${await this.standardNgf.setItem('foo', data)}`);
console.log(`Set explicitly to localStorage: ${await this.ngf.setItem('bar', data)}`);
}
}
from ngforage.
thanks :)
from ngforage.
Related Issues (20)
- An in-range update of @angular-devkit/build-ng-packagr is breaking the build 🚨 HOT 1
- NPM-Warnings on Angular 8 HOT 3
- An in-range update of @types/node is breaking the build 🚨 HOT 1
- An in-range update of @types/jasmine is breaking the build 🚨 HOT 4
- An in-range update of @types/jasminewd2 is breaking the build 🚨 HOT 2
- The documentation seems to be broken. HOT 1
- Docs: What's the difference between NgForage and NgForageCache? HOT 3
- Add sample from NgforageCache issue to docs
- Angular 9 support HOT 17
- Angular 8 AOT Unexpected value NgForageModule HOT 1
- localforage.d.ts
- Refreshing the page cannot fetch Store Value
- Angular 10 Support HOT 4
- Angular 11 support HOT 1
- The automated release is failing 🚨 HOT 1
- Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID on Angular 13
- Need to iterate all keys
- Angular 14 support HOT 2
- Angular 16 Support HOT 4
- Angular 17 Support HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngforage.