I get this error when i try to load page.
src/account/account.ts
import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { AuthService } from ‘…/…/providers/auth-service/auth-service’;
/**
- Generated class for the AccountPage page.
- See https://ionicframework.com/docs/components/#navigation for more info on
- Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: ‘page-account’,
templateUrl: ‘account.html’,
providers: [AuthService]
})
export class AccountPage {
bookings: any;
constructor(public navCtrl: NavController, public navParams: NavParams, public authService: AuthService) {
this.mybooking();
}
mybooking(){
this.authService.mybooking().subscribe((data)=>{
this.bookings = data;
});
}
auth-service.ts
@Injectable()
export class AuthService {
constructor(public http: Http) {}
mybooking() {
return new Promise((resolve, reject) => {
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);
this.http.get(mybookingurl, JSON.stringify(data), {headers: headers})
.subscribe(res => {
resolve(res.json());
}, (err) => {
reject(err);
});
});
}