i have piece of code:
import { component } '@angular/core'; import { navcontroller, loading, alert } 'ionic-angular'; @component({ templateurl: 'build/pages/search/search.html', }) export class searchpage { constructor (....) { // code here } finditems() { let loading = loading.create({ content: "finding items..." }); this.nav.present(loading); // other stuff here } when run ionic serve shows correctly when click button calls finditems() method error:
error ts2341: property 'create' private , accessible within class 'loading an analogous errors appears if do:
let alert = alert.create({ title: 'hello!', }); in case in terminal appears following message:error ts2341: property 'create' private , accessible within class 'alert'.
i'm working ionic2 version 2.0.0-beta.36
edit: applies beta 11 , higher
this because create private function of class loading, , therefore not callable outside of loading class.
the code example ionic's documentation shows loadingcontroller class used instantiate loading object desired options. start there.
import { loadingcontroller } 'ionic-angular'; //... constructor(private loadingcontroller: loadingcontroller) { } finditems() { let loading = this.loadingcontroller.create({ content: "finding items..." duration: 3000 }); loading.present(); // other stuff here }
Comments
Post a Comment