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"ide

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

相关文章
相关标签/搜索