[Angular2 Router] Redirects and Path Matching - Avoid Common Routing Pitfall
and path Router Common matching Angular2 routing avoid
2023-09-14 08:59:19 时间
In this tutorial we are going to learn how we can can configure redirects in the angular 2 router configuration. We are also going to see again another example on how the order of the configuration might trip us. We are going to see the different between path matching in prefix mode vs full mode, and we are going to learn why redirects should be in general configured using full path matching.
{path: 'legacy-url', redirectTo: '/home', pathMatch: 'full'},
pathMatch: 'full' : only match 'legacy-url', won't match 'legacy-url/1';
{path: 'legacy-url', redirectTo: '/home', pathMatch: 'prefix'},
pathMatch: 'prefix' : not only match 'legacy-url', but also match 'legacy-url/1';
Notice, this redirectTo should be define on the top of other routers.
相关文章
- Building the Unstructured Data Warehouse: Architecture, Analysis, and Design
- [Vue-rx] Handle Image Loading Errors in Vue.js with RxJS and domStreams
- [Javascript] Getter and Setter Abstractions
- [Ramda] Get Deeply Nested Properties Safely with Ramda's path and pathOr Functions
- [CSS] Create Complex Shapes with CSS Clip Path and Border Radiusc (border-radius & clip-path)
- [Vue-rx] Disable Buttons While Data is Loading with RxJS and Vue.js
- [Ramda] Get Deeply Nested Properties Safely with Ramda's path and pathOr Functions
- [Linux] Install java and add JAVA_HOME, PATH
- between...and..
- Atitit Gaussian Blur 高斯模糊 的原理and实现and 用途
- Atitit.404错误解决标准流程and url汉字中文路径404错误resin4 resin chinese char path 404 err解决
- 【Codeforces 1083A】The Fair Nut and the Best Path
- 【Henu ACM Round#15 C】 A and B and Team Training
- 【目标检测】27、GIoU:Generalized Intersection over Union:A Metric and A Loss for Bounding Box Regression
- 成功解决TypeError: ufunc 'sqrt' not supported for the input types, and the inputs could not be safely co
- LVGL 8.2 Line wrap, recoloring and scrolling
- 论文解读(FDGATII)《FDGATII : Fast Dynamic Graph Attention with Initial Residual and Identity Mapping》