Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

angular - 带角6的离子4路由(Ionic 4 routing with angular 6)

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

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

1 Reply

0 votes
by (71.8m points)

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示例。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...