angular - Use a service in another service -
i have 2 services :
- userservice
- todolistservice
i import todolistservice in userservice, have error :
uncaught error: can't resolve parameters userservice: (?, [object object], [object object], [object object]).
i don't understand, tried move import of barrel , order in constructor, no change ..
my services declared in "providers" in app.module.ts
userservice.ts :
import {injectable} '@angular/core'; import {angularfiredatabase, firebaselistobservable} "angularfire2/database"; import {facebook} "@ionic-native/facebook"; import {platform} "ionic-angular"; import firebase 'firebase'; import {todolistservice} "./todolistservice"; @injectable() export class userservice { usersfire: firebaselistobservable<any[]>; platform: any; uid: any; userprofile: = null; constructor(public db: angularfiredatabase, public fb: facebook, platform: platform, public todolistservice: todolistservice) { this.usersfire = db.list('/users'); this.platform = platform; this.uid = ''; }
todolistservice :
import {injectable} '@angular/core'; import {storage} '@ionic/storage'; import {angularfiredatabase, firebaselistobservable} 'angularfire2/database'; import * moment 'moment'; import 'rxjs/add/operator/map'; import {observable} "rxjs/observable"; import { alertcontroller } 'ionic-angular'; import {userservice} "./userservice"; @injectable() export class todolistservice { todolistfire: firebaselistobservable<any[]>; statutfire: firebaselistobservable<any[]>; localstorage = []; displaytodo: array<any> = []; statuts: array<any> = []; // données à enregistrer dans firebase dateoftheday: string; dayofweek: number; constructor(public afdb: angularfiredatabase, public storage: storage, public alertctrl: alertcontroller, public userservice: userservice) { moment.locale('fr'); this.dateoftheday = moment().format('l'); // date au format : 04/07/2017 this.dayofweek = moment().day(); // numéro du jour de la semaine (ex : 1 pour lundi) this.todolistfire = this.afdb.list('/todolist', { query: { orderbychild: 'uid', equalto: this.userservice.uid } }); this.statutfire = this.afdb.list('/statut'); }
thanks in advance help
Comments
Post a Comment