[英]can anyone explain why (http://localhost:3000/#/home) # occurs inbetween the url
我是angular js和node js的新手,我有些怀疑,谁能解释为什么#出现在url(localhost:3000 /#/ home)之间
#
in the URL segment denotes tag id used to automatically jump to that section in a long page. URL段中的
#
表示用于自动跳转到长页面中该部分的标签ID。 Now-a-days this is used by java-script frameworks like angular for virtual navigation purpose ie, changing the part after #
does not cause a full page reload by the browser and used internally which div
element to show/hide in a SPA(Single Page Applications). 如今,它已被java-script框架(例如angular)用于虚拟导航目的,即,在
#
之后更改部分不会导致浏览器重新加载整个页面,并在内部使用哪个div
元素显示/隐藏在SPA(单页应用程序)。
It is a way for older browsers to not do a full reload of the page when you navigate in your single page application in AngularJS. 当您在AngularJS中浏览单页应用程序时,这是较旧的浏览器不完全重新加载页面的一种方法。
It is called Hashbang and you can read more about it in the documentation: 它称为Hashbang,您可以在文档中阅读有关它的更多信息:
https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes
Those are called Hashbang URLs. 这些称为Hashbang URL。 Generally anything that us after Hash #, is not another URL but it still belongs to the same HTML page.
通常,我们在哈希号之后的所有内容都不是另一个URL,但它仍属于同一HTML页面。 With increasing JS libraries and increasing capabilities of web browsers, now we can replace URLs using HTML5 history API.
随着JS库的增加和Web浏览器功能的增加,现在我们可以使用HTML5历史API替换URL。
This hashbang technique is used as a fallback for older browsers, ie, the whole application runs on a single HTML page and Angular watches for any # hash changes in the URL and triggers the appropriate route controller. 该hashbang技术用作旧版浏览器的后备,即,整个应用程序在单个HTML页面上运行,并且Angular监视URL中的任何#哈希更改并触发适当的路由控制器。
I suggest you to read more on hashbang URLs: Doing links like Twitter, Hash-Bang #! 我建议您阅读有关hashbang URL的更多信息: 做Twitter,Hash-Bang等链接! URL's
网址
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.