本文介绍了需要澄清 RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true })的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请解释一下angular 2路由方法中的useHash: true
方法.
Kindly explain useHash: true
method in angular 2 route method.
我的问题:
我们使用它的目的是什么.
what is the purpose we using it.
为什么值是真"为什么不是假"?
why the value is "true" why not "false" ?
如果值为假,会发生什么?
if the value is false, what could be happen ?
RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true })
推荐答案
默认情况下,angular 使用 HTML5
基于位置的路由,这可能会导致您在某些环境中出现问题.出于简单性的考虑,我们通常更喜欢基于哈希的路由,它在各种环境中都能正常工作.您可以查看 这篇文章 了解 angular 2 路由
By default, angular uses HTML5
location-based routing, which may cause you problems in some environments. In the shake of simplicity, we usually prefer hash-based routing which regularly works in every environment. You can have a look at this post for angular 2 routing
这篇关于需要澄清 RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true })的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!