我正在使用.net framework 4.5和angularjs在网站上开发一个应用程序。我在发布项目后遇到了关于父路径的问题。 我的项目结构是 -
D:\abc\
->app
-appdata
-css
-faltify
-img
-js
-controllers
LoginController.js
-services
LoginService.js
->Login.html
其中app文件夹和Login.html位于同一级别。我在LoginController
中将LoginService
和Login.html
的路径视为
<script src="../app/js/services/LoginService.js"></script>
<script src="../app/js/controllers/LoginController.js"></script>
和其他导演的文件相同。
我在IIS服务器上发布它并将Login.html作为默认页面,这样当我浏览它时,它可以显示Login.html页面。当我在本地运行应用程序时,它运行正常。但是当我使用http://localhost:8090/1
(这里的1是记录的id)使用url浏览IIS时,它会发出错误
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Requested URL http://localhost:8090/1
Physical Path C:\websites\abc\ui\1
当我将网址设为http://localhost:8090/#/1
时,它工作正常。但我不想在网址中提供#
。我在Login.html中给出了错误的路径吗?这有什么解决方案吗?我只想使用http://localhost:8090/1
访问Login.html。请帮忙。
答案 0 :(得分:0)
你可能正在寻找的是$ locationProvider上的html5Mode。它可以帮助你提出漂亮的网址。看看https://scotch.io/quick-tips/pretty-urls-in-angularjs-removing-the-hashtag
希望这会有所帮助