[Angular2 Router] Redirects and Path Matching - Avoid Common Routing Pitfall
2024-08-31 17:11:42
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.
最新文章
- 基于node.js的压缩合并安装
- iPad Pro分辨率
- WampServer64提示You don't have permission to access
- php图片下载
- CSS基础知识点(二)——选择器
- Azure Redis Cache作为ASP.NET 缓存输出提供程序
- /dev/shm(转)
- 微信小程序开发 -- 01
- java对象 深度克隆(不实现Cloneable接口)和浅度克隆
- python之路--day11---迭代器和生成器
- TCP的发送系列 — 发送缓存的管理(一)
- Redis 小白指南(二)- 聊聊五大类型:字符串、散列、列表、集合和有序集合
- 题解:[APIO2007]风铃
- Beta冲刺 3
- jqueryui插件slider的简单使用
- Zabbix系列之一——zabbix3.4部署
- mysql中的sql_mode
- Wifi小车资料
- 启用Nginx目录浏览功能的方法
- Codeforces Round #456 (Div. 2) B. New Year's Eve