简体   繁体   English

Angular / Django应用中的URL和链接突然中断

[英]URLs and linking abruptly broken in Angular / Django app

Recently, something changed on my Django / Angular app that broke all of my front-end URLs and links. 最近,我的Django / Angular应用程序发生了更改,使我的所有前端URL和链接都中断了。

For example, our root domain has stayed the same, but our location URLs changed from /<campus.slug>/#campus_info to /<campus.slug>/#/campus_info and it's breaking every link throughout our site. 例如,我们的根域保持不变,但是我们的位置URL从/<campus.slug>/#campus_info更改为/<campus.slug>/#/campus_info ,这破坏了整个站点的每个链接。

I tried using $locationProvider.html5Mode(true) and <base> to change the base URL of our site, but it didn't fix them. 我尝试使用$locationProvider.html5Mode(true)<base>来更改我们网站的基本URL,但它没有解决它们。 I can't seem to make in-page anchor links work either. 我似乎也无法使页内定位链接起作用。 The only links that work now are Django links. 现在唯一有效的链接是Django链接。

Has anyone else encountered an issue like this? 还有其他人遇到过这样的问题吗? I'm completely lost on how this even broke. 我完全不知道该如何打破。 I haven't touched routing or URL stuff in months on the site, and that's what's even more confusing to me. 我已经有好几个月没有在网站上浏览路由或URL了,这让我更加困惑。

Any feedback or tips would be appreciated on this, thanks in advance. 任何反馈或提示,对此将不胜感激,在此先感谢。

As per this article, $location interferes with some versions of UI-Bootstrap and can have adverse effects on your URLs. 按照文章, $location与UI的自举的一些版本干扰并可能对您的网址不利影响。

After removing a $location dependency from my controller that was affecting this code, I was able to fix my URL's and get all my anchor links and SPA linking working again. 从控制器中删除了影响该代码的$location依赖关系后,我得以修复URL,并使所有锚链接和SPA链接重新工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM