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.

最新文章

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

热门文章

  1. Python学习笔记3:简单文件操作
  2. java对象和json数据转换实现方式1-使用json-lib实现
  3. Codeforces Beta Round #2 C. Commentator problem
  4. IOS开发人员经常使用的10个Xcode插件
  5. 76.Nodejs Express目录结构
  6. C#开发 —— 高级应用
  7. css--两行显示省略号兼容火狐浏览器
  8. angular入门(基础篇)
  9. golang-小试牛刀
  10. stm8开发环境配置及测试