Property 'x' Is Private And Only Accessible Within Class 'y'
I have this piece of code: import { Component } from '@angular/core'; import { NavController, Loading, Alert } from 'ionic-angular'; @Component({ templateUrl: 'bu
Solution 1:
EDIT: This only applies to beta 11 and higher
This is because create
is a private function of the class Loading
, and therefore not callable outside of the Loading
class.
The code example from Ionic's documentation shows a LoadingController
class used to instantiate the Loading object with the desired options. I would start there.
import { LoadingController } from'ionic-angular';
//...constructor(private loadingController: LoadingController) {
}
findItems() {
let loading = this.loadingController.create({
content: "Finding items..."duration: 3000
});
loading.present();
// other stuff here
}
Solution 2:
It looks like the syntax for Alerts has changed. Here's the new syntax:
import { AlertController } from'ionic-angular';
exportclassMyPage {
constructor(private alertController: AlertController){
}
showAlert() {
let alert = this.alertController.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
}
}
Post a Comment for "Property 'x' Is Private And Only Accessible Within Class 'y'"