未捕获错误:无法解析存储的所有参数:(?)

时间:2017-07-13 12:29:18

标签: sqlite typescript ionic2

enter image description here 我采取(未捕获错误:无法解析存储的所有参数:(?))错误。怎么能解决这个错误。请帮帮我,我不能在ionic2中使用sqlite。您可以在github中向我发送任何离子2 sqlite示例。

从现在起Thanx。

app.module.ts

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';

import { KanalyaratPage } from '../pages/kanalyarat/kanalyarat';
import { KanalPage } from '../pages/kanallistele/kanallistele';
import { TabsPage } from '../pages/tabs/tabs';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { DbProvider } from '../providers/db/db';
import { IonicStorageModule } from '@ionic/storage';
import { HttpModule } from '@angular/http';
import { SQLitePorter } from '@ionic-native/sqlite-porter';
import { SQLite } from '@ionic-native/sqlite';
import { Storage } from '@ionic/storage';
import { TaskServiceProvider } from '../providers/task-service/task-service';


@NgModule({
  declarations: [
    MyApp,
    KanalyaratPage,
    KanalPage,
    TabsPage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicStorageModule.forRoot(),
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    KanalyaratPage,
    KanalPage,
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    Storage,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    DbProvider,
    DbProvider,
    SQLitePorter,
    SQLite,
    TaskServiceProvider
  ]
})
export class AppModule {}

kanallistele.ts(home.ts)

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DbProvider } from '../../providers/db/db';

@Component({
  selector: 'page-home',
  templateUrl: 'kanallistele.html',
})
export class KanalPage {
  developers = [];
  developer = {};

  constructor(public navCtrl: NavController , private databaseProvider : DbProvider) {
    this.databaseProvider.getDatabaseState().subscribe(rdy =>{
      if(rdy)
        {
          this.loadDeveloperData();
        }
    })

    }

   loadDeveloperData() {
    this.databaseProvider.getAllDevelopers().then(data => {
      this.developers = data;
    })
  }

    addDeveloper()
    {
      this.databaseProvider.addDeveloper(this.developer['name'],this.developer['skill'],this.developer['yearsOfExperience'])
      .then(data =>{
        this.loadDeveloperData();
      });
      this.developer ={};
    }
}

1 个答案:

答案 0 :(得分:1)

只需关注docs

即可

您不必从NgModule向“providers”数组添加存储(从离子本机)。