angular2--Tour of Heroes学习和分析--路由

引入路由模块时的一个报错


No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.

解决办法


<head>  

<!-- 加上这个标签 -->
<base href="/">  

...  

</head>

原因分析


"The tells the Angular router what is the static part of the URL. The router then only modifies the remaining part of the URL"

大概意思:angular路由对象需这么一个标签,来告诉它url的静态部分,即到时候不需要修改的部分。 而剩下的路由去修改。

posted @ 2017-04-12 12:02  o0Luffy0o  阅读(395)  评论(0编辑  收藏  举报