Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Im trying to update a legacy ionic app to v4 at the moment but cant seem to find a v4 equivalent to this navigation

(我目前正在尝试将旧版离子应用更新为v4,但似乎找不到与此导航等效的v4)

     return this.app.getRootNav().setPages([
         {page: Profile},
         {page: SettingsPage, params: {id: userId}}
     ])
  ask by Kravitz translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
468 views
Welcome To Ask or Share your Answers For Others

1 Answer

Ionic4 and angular version of your request is like this :

(Ionic4和您的请求的角度版本是这样的:)

   this.router
  .navigate(["/page1"], { replaceUrl: true })
  .then(() => this.router.navigate(["/page2"]));

The logic is here as i understand.

(据我了解,这里的逻辑。)

Push page1 into history but navigate to page2 so if user pushes the back button it redirects to page1.

(将page1推入历史记录,但导航至page2,因此,如果用户按“后退”按钮,它将重定向到page1。)

Here is the stackblitz sample.

(这是stackblitz示例。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...