https://github.com/dimpu/angular2-loki
Lokijs with localforgage for angualr2, Ionic, NativeScript applications.
https://github.com/dimpu/angular2-loki
Last synced: 3 months ago
JSON representation
Lokijs with localforgage for angualr2, Ionic, NativeScript applications.
- Host: GitHub
- URL: https://github.com/dimpu/angular2-loki
- Owner: dimpu
- License: mit
- Created: 2016-10-26T02:17:58.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-15T10:48:01.000Z (about 8 years ago)
- Last Synced: 2025-10-13T09:06:53.212Z (3 months ago)
- Language: TypeScript
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# angular2-loki
Lokijs for angular2, Ionic 2, NativeScript with Angualr.
How to use
```shell
npm install angular2-loki
```
```ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { LokiModule } from './loki/loki.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
LokiModule,
.....
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
```ts
import { Component } from '@angular/core';
import { LokiService } from 'angular2-loki';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private loki: LokiService) {
let db = loki.init('mydb.txt');
// db will export lokijs object
// full docs at https://rawgit.com/techfort/LokiJS/master/jsdoc/Loki.html
let users = db.addCollection('users');
users.insert({
name: 'Odin',
age: 50,
address: 'Asgard'
});
console.log(users.findOne({ name: 'Odin' }));
}
}
```