如何在 angularjs 中禁用路由? [英] How to disable routing in angularjs?
问题描述
我有一个单页应用程序,它实际上只有一个页面.只有一个视图使用 angularjs 完成了大量 javascript/ajax 逻辑,但没有路由到其他视图.
I have a single page application that really just has one single page. There's just the one view that has lots of javascript/ajax logic done with angularjs, but there's no routing to other views involved.
因此,我想去掉 url 末尾的 hashbang (#/).我可以以某种方式完全关闭 angularjs 路由吗?
Therefore I'd like to git rid of the hashbang (#/) at the end of the url. Can I somehow turn off angularjs routing completely?
顺便说一句:我知道 Htm5Mode,但我希望它适用于所有浏览器.
Btw: I know about Htm5Mode, but I want it to work in all browsers.
推荐答案
如果您没有定义 $routeProvider
,则不会有路由,因此您的 url 中不会有哈希值.
If you don't have a $routeProvider
defined, there will be no routing, and therefore no hash in your url.
这篇关于如何在 angularjs 中禁用路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!