2017-05-25 68 views
0

类型 'IonicStorageModule'中不存在Typescript错误属性'set'。类型'IonicStorageModule'上不存在属性'set'

C:/Users/Kamleshutube/HDKProject/src/pages/login/login.ts this.storage.set('mydata','kamlesh'); 类型'IonicStorageModule'上不存在Typescript错误属性'get'。 C:/Users/Kamleshutube/HDKProject/src/pages/login/login.ts

this.storage.get('mydata',(data)=>{ 
    console.log(data); 
+0

你可以发表你的完整代码中设置IonicStorageModule.forRoot()? –

回答

2

IonicStorageModule仅供app.module.ts

设置你需要输入下面的代码存储在你的页面

import { Storage } from '@ionic/storage'; 

并在构造函数中添加它然后设置使用this.storage.set(key,value);

阿尔斯ØDONOT设置IonicStorageModule为供应商

,进口 这样

imports: [ 
    BrowserModule, 
    HttpModule, 
    SwingModule, 
    IonicModule.forRoot(MyApp), 
    IonicStorageModule.forRoot() 
    ], 
相关问题