<button class="alt-button" ion-item detail-none (click)="goToAbout()" clear small >
<ion-icon name='person' item-left></ion-icon>About us</button>
按鈕動作ionic2一套高速緩存視圖
goToAbout() {
this.menu.close();
// close the menu and Goto About page
this.app.getRootNav().push(AboutPage);
}
API調用
ionViewDidLoad(){
this.loading.present();
this.aboutservice.getPost().then(
response => {
this.items = response
this.loading.dismiss();
},
error=>{
this.error = error
this.showError('There was problem with server');
this.loading.dismiss();
});
}
它加載API數據每次,但我想一次和同一個按鈕加載API數據我已經用於sidemenu的行動,它的工作fine.please給任何想法。
哪裏的API調用代碼? – Sampath
我已更新代碼 –
我已將api調用放入construtor中,仍然出現加載問題 –