Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Cannot resolve all parameters for 'Storage'(?, ?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Storage' is decorated with Injectable

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>