1// npm install ngx-indexed-db
2
3import { NgxIndexedDBModule } from 'ngx-indexed-db';
4
5const dbConfig: DBConfig = {
6 name: 'MyDb',
7 version: 1,
8 objectStoresMeta: [{
9 store: 'people',
10 storeConfig: { keyPath: 'id', autoIncrement: true },
11 storeSchema: [
12 { name: 'name', keypath: 'name', options: { unique: false } },
13 { name: 'email', keypath: 'email', options: { unique: false } }
14 ]
15 }]
16};
17
18@NgModule({
19 ...
20 imports: [
21 ...
22 NgxIndexedDBModule.forRoot(dbConfig)
23 ],
24 ...
25})
26