是什么
路由:就是从一个页面跳到另一个页面,当用户输入一个url跳到一个页面,之后用户点击某控件或者输入另一个url之后就跳到另一个页面,实际上,就是页面的跳来跳去。然而,Angular是组件化应用,所以Angular的页面就是组件,跳到页面,其实就是实例化组件渲染到页面上。总的来说,就是url与组件的对应关系。
优缺点
相对于之前直接配置url的方式相对复杂了一些。
组成
Angular路由有两种路由策略,一种是HashLocationStrategy,另一种是PathLocationStrategy。
HashLocationStrategy
浏览器向服务器服务器发送请求时不会带上hash部分。例如浏览器发送http://lo