gpt4 book ai didi

asp.net-mvc-4 - 如何将 ASP.Net MVC4 Web API 与 AngularJS 部分 View (又名 ng-include)一起使用

转载 作者:行者123 更新时间:2023-12-04 16:53:18 25 4
gpt4 key购买 nike

是否可以退货 '*.htm' 来自 ASP.Net MVC4 Web API 应用程序的文件?

我正在尝试使用 AngularJs 来管理客户端 View ,当我在我的页面上包含以下推荐时:

<div ng-controller="application.RootController">
<div ng-switch="subview" >
<div ng-switch-when="home" ng-include="'../Views/Angular/customer/overview.htm'"></div>
<div ng-switch-when="admin" ng-include="'../Views/Angular/Admin/home.htm'"></div>
</div>
</div>

我看到这在浏览器上按预期工作,但 ASP.Net 返回 404 页面未找到。

此外,我无法物理浏览任何 htm 页面,所以在配置路由以返回 htm 页面方面,我需要在 ASP.Net MVC 中做一件特别的事情吗?

最佳答案

~/Views 中的文件文件夹不直接提供。您应该将您的 HTM 页面放在其他地方。例如,您可以有一个 ~/Angular文件夹。

关于asp.net-mvc-4 - 如何将 ASP.Net MVC4 Web API 与 AngularJS 部分 View (又名 ng-include)一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19950177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com