Ada*_*lin 12 iis asp.net-mvc angularjs
我在使用MVC的IIS 8.x上遇到了Angular JS的问题.我的虚拟目录应用程序索引页是这样的:
https://myapp.xyz/VirtualDirectory/
Run Code Online (Sandbox Code Playgroud)
该页面加载角度应用程序.我的角度路线设置为:
$routeProvider
.when('/', {
templateUrl: 'Content/Partials/Home/Index.html'
})
.when('/Error', {
templateUrl: 'Content/Partials/Shared/Error.html'
})
.otherwise({
redirectTo: '/Error'
});
Run Code Online (Sandbox Code Playgroud)
所以,如果我访问第一个链接,我的URL看起来像:
https://myapp.xyz/VirtualDirectory/#/
Run Code Online (Sandbox Code Playgroud)
这完美地工作,并解决了我的偏好.Angular请求部分包含虚拟目录,因此我看到一个HTTP请求:
https://myapp.xyz/VirtualDirectory/Content/Partials/Home/Index.html
Run Code Online (Sandbox Code Playgroud)
但是,如果我在没有尾部斜杠的情况下访问:
https://myapp.xyz/VirtualDirectory
Run Code Online (Sandbox Code Playgroud)
Angular航线:
https://myapp.xyz/VirtualDirectory#/
Run Code Online (Sandbox Code Playgroud)
一旦发生这种情况,我的路线都不起作用(他们不尊重虚拟目录).他们路由为:
https://myapp.xyz/Content/Partials/Home/Index.html
Run Code Online (Sandbox Code Playgroud)
这会破坏我的指令中定义的所有路由和模板.有关如何解决此问题的任何建议?
小智 14
尝试在头标记中添加此内容.
<html>
<head>
<base href="/VirtualDirectory/">
</head>
<body>
...
</body>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4676 次 |
最近记录: |