2017-11-18 11 views
-2

이제 Ionic3, Angular4 android app를 사용 중입니다. 그것은 이전 페이지로 돌아갈 때마다 안드로이드 애플 리케이션에서 페이지를 다시로드하고 있습니다. 이것을 막을 수있는 방법. 여전히 해당 페이지가 이미로드되었습니다. 그래서 나는 몇 번이고 다시로드하고 싶지 않다.이전 페이지로 돌아 가면 페이지를 다시로드하지 못하게하려면 어떻게해야합니까?

+0

할 기억은 우리에게 몇 가지 코드를 보여줍니다. 다시로드하면 무엇을 의미합니까? –

답변

0

이온 프레임 워크에 Push and Pop을 사용한다. 새로운 프레임이 푸시되고 팝 아웃 된 간단한 스택으로 작동하며, 역사에서 앞뒤로 움직이는 것에 해당한다.

Refer Ionic documentation too

@Component({ 
    template: ` 
    <ion-header> 
    <ion-navbar> 
     <ion-title>Login</ion-title> 
    </ion-navbar> 
    </ion-header> 

    <ion-content> 
    <button (click)="goToOtherPage()"> 
     Go to OtherPage 
    </button> 
    </ion-content>` 
}) 
export class StartPage { 
    constructor(public navCtrl: NavController) {} 

    goToOtherPage() { 
    //push another page onto the history stack 
    //causing the nav controller to animate the new page in 
    this.navCtrl.push(OtherPage); 
    } 
} 

@Component({ 
    template: ` 
    <ion-header> 
    <ion-navbar> 
     <ion-title>Other Page</ion-title> 
    </ion-navbar> 
    </ion-header> 

    <ion-content>I'm the other page!</ion-content>` 
}) 
class OtherPage {} 
0

사용 this.navCtrl.push(Page); 대신 this.navCtrl.setRoot(Page);

ionViewWillEnter() { 
    this.viewCtrl.showBackButton(true) 
} 

goBackToPreviousPage() { 
    this.navCtrl.pop(); 
}