ngx-localforage's People
ngx-localforage's Issues
[Example] Can you provide an example to create an instance of localforage using LocalForageFactory and LocalForageToken
(as you have suggested in ReadMe)
general help
Hi ,
I am trying to use ngx-localforage in my angualr4 project that uses node.js
I need it to work online and offline and need some help :
-
is ngx-localforage support the same Browsers Platformsas as localforage support ?
https://github.com/localForage/localForage/wiki/Supported-Browsers-Platforms -
Is there any example code of angular project that uses it ?
thanks
Tami
Multiple Instances
How can this be implemented in the current library? Can you expose the methods to createInstance and dropInstance?
I got TypeError: this.localForage.setItem is not a function when run unit test
*****file *.spec.ts
import { TestBed, inject } from '@angular/core/testing';
import { LocalStorageService } from './local-storage.service';
import { LocalForageService, LocalForageToken } from 'ngx-localforage';
describe('LocalStorageService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [LocalStorageService, LocalForageService, LocalForageToken]
});
});
it('should be created', inject([LocalStorageService], (local: LocalStorageService) => {
expect(local).toBeTruthy();
}));
it('should have properties and methods', inject([LocalStorageService], (local: LocalStorageService) => {
expect(local.setAdminAuth).toBeDefined();
expect(local.getAdminAuth).toBeDefined();
}));
describe('Service return correct result', () => {
let expectedResult = { username: 'user1', password: 'test1234' };
it('should pass the result as Promise', inject([LocalStorageService], (local: LocalStorageService) => {
**local.setAdminAuth**('user1', 'test1234').then((result) => {
expect(result).toEqual(expectedResult);
})
}));
});
});
##############################################################
import { Injectable } from '@angular/core';
import { LocalForageService } from 'ngx-localforage';
@Injectable()
export class LocalStorageService {
constructor(private local: LocalForageService) { }
setAdminAuth(username = '', password = '') {
return this.local.setItem('admin-auth', { username: username, password: password }).toPromise();
}
getAdminAuth() {
return this.local.getItem('admin-auth').toPromise();
}
}
######################################################
TypeError: this.localForage.setItem is not a function
at LocalForageService.webpackJsonp.../../../../ngx-localforage/dist/localforage.service.js.LocalForageService.setItem (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/ngx-localforage/dist/localforage.service.js:19:1)
at LocalStorageService.webpackJsonp.../../../../../src/app/local-storage.service.ts.LocalStorageService.setAdminAuth (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/src/app/local-storage.service.ts:10:27)
at UserContext. (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/src/app/local-storage.service.spec.ts:39:19)
at TestBed.webpackJsonp.../../../core/esm5/testing.js.TestBed.execute (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/@angular/core/esm5/testing.js:1013:1)
at UserContext. (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/@angular/core/esm5/testing.js:1143:29)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/zone.js/dist/zone.js:392:1)
at ProxyZoneSpec.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/zone.js/dist/proxy.js:79:1)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/zone.js/dist/zone.js:391:1)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/zone.js/dist/zone.js:142:1)
at UserContext. (http://localhost:9876/_karma_webpack_/webpack:/usr/local/www/tuifree-web/node_modules/zone.js/dist/jasmine-patch.js:104:1)
How to fix this case?
angular5
test with karma unit test.
This module is not AOT compliant
Hello,
Thank you for developing this module! I love localforage and I love angular2.
I was getting an error when trying to build my app using AOT:
Uncaught Error: Unexpected value 'undefined' imported by the module 'LocalForageModule'
I believe these are caused by the export * from
in the barrel files. See here for why.
I've managed to fix this, will be pushing a pull request soon.
Add support for Angular6
How Do I Connect This ?
`let localforage: LocalForage
const config: LocalForageConfiguration = {
driver: localforage.INDEXEDDB,
name: 'Cashier',
version: 1.0,
storeName: 'transact_1', // Should be alphanumeric, with underscores.
description: 'Transactions',
size: 100000000
};
this.localforage.config(config).subscribe(() => {
console.log('Localforage configured :D');
}), (err => console.error('Error configuring localforage', err));
`
localforage indexeddb is returning null =_= any help?
Multiple stores
How to create multiple stores?
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.