@neozhu wrote:
`import {Storage,SqlStorage} from 'ionic-angular'; import {Injectable} from 'angular2/core'; import {Contact} from '../modules/Contact'; @Injectable() export class DataService{ private data:Array<Contact>; private storage:Storage; constructor(){ this.storage=new Storage(SqlStorage,{name:'contact-app'}); this.data=null; this.storage.get('contact-app').then((contacts)=>{ this.data=JSON.parse(contacts); }) } getData(){ return this.storage.get('contact-app'); } save(item){ if(!this.data){ this.data=[item]; let newData=JSON.stringify(item); this.storage.set('contact-app',newData); }else{ this.data.push(item); let newData=JSON.stringify(this.data); this.storage.set('contact-app',newData); } } }`error
app.bundle.js:17029Uncaught TypeError: Cannot read property 'getOptional' of undefined
exports.PlatformRef_ = PlatformRef_;
function _runAppInitializers(injector) {
var inits = injector.getOptional(application_tokens_1.APP_INITIALIZER);bug?
Posts: 1
Participants: 1