Lokijs with localforgage for angualar2, Ionic, NativeScript applications.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 4 commits ahead of dimpu:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
e2e
src
.editorconfig
.gitignore
.npmignore
LICENSE
README.md
angular-cli.json
index.ts
karma.conf.js
package.json
protractor.conf.js
tsconfig.json
tslint.json

README.md

angular2-loki

Lokijs for angular2, Ionic 2, NativeScript with Angualr.

How to use

npm install angular2-loki
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 { }
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' }));
  }
}