【发布时间】:2017-05-22 00:57:54
【问题描述】:
您好,我一直在学习有关 Angular 的 Asp.net Core 教程。但我只对角度部分感兴趣,我没有使用 Asp.net 核心。 我处于您可以通过使用此方法轻松地将任何部分 html 包含到我的 mvc/asp/angular 应用程序的部分:
主模块
(function(){
"use strict";
angular.module("app-test", ["simpleControls"]);
})();
指令
(function () {
"use strict";
angular.module("simpleControls", [])
.directive("waitCursor", waitCursor);
function waitCursor() {
return {
templateUrl: "/Views/Helper/WaitCursor.html"
};
}
})();
部分 html - 位于 Views/Helper/
<div class="text-center">
<i class="fa fa-spinner fa-spin"></i> Loading...
</div>
主 html
<wait-cursor ng-show="true"></wait-cursor>
我尝试过: templateUrl: "~/Views/Helper/WaitCursor.html"
templateUrl: "Views/Helper/WaitCursor.html"
templateUrl: "WaitCursor.html" -> 包含主根文件夹中的文件
为什么它可以在 ASP Core 中工作,正如我在教程中看到的那样,但不能在正常的 asp.net mvc 4(我正在使用的)中以及如何解决这个问题。
【问题讨论】:
标签: asp.net angularjs asp.net-mvc-4