Hello i am using authservice to call my MySql database with PHP api and therefore my php functions for my Ionic 3 Angular 4 app.
This is how i call to get userData and it works fine
import { AuthService } from "../../providers/auth-service";
public authService: AuthService,
private loadingCtrl: LoadingController
) {
const data = JSON.parse(localStorage.getItem("userData"));
this.userDetails = data.userData;
this.userPostData.uid = this.userDetails.uid;
let loader = this.loadingCtrl.create({
content: 'Please wait...'
});
I have another project that uses AngularFirestone
import { AngularFirestore, AngularFirestoreDocument } from 'angularfire2/firestore';
import { AngularFireAuth } from 'angularfire2/auth';
import { Storage } from '@ionic/storage';
and calls the constructor like this
private users: AngularFirestoreDocument<{}>;
constructor(public navCtrl: NavController,
private afService: AngularFirestore,
private storage: Storage,
private loadingCtrl: LoadingController,
private afAuth: AngularFireAuth) {
this.uid = localStorage.getItem('uid');
this.users = this.afService.collection('users').doc(this.uid);
let loader = this.loadingCtrl.create({
content: 'Please wait...'
});
loader.present();
this.users.valueChanges()
.subscribe((res: any) => {
this.canDoMessage = res.canDoMessage;
loader.dismiss();
}, error => {
loader.dismiss();
});
}
What i am asking how i call the users in my case? My authservice case