[angularjs]角的 Url 模板投掷无法找到资源

发布时间: 2017/4/16 0:50:29
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

我想在我的网页上实现分页和我收到下面的错误。

angular.min.js:87 GET http://localhost:56485/Areas/EVerify/Views/EVerify/dirPagination.tpl.html 404 (Not Found)

js 文件︰

var EVerifyModule = angular.module('EVerifyModule', ['angularFileUpload', 'ui.bootstrap', 'angularUtils.directives.dirPagination']);

EVerifyModule.controller('EVerifyController', ['$scope', '$http', '$compile', function ($scope, $http, $compile) {

                           var EmployeeInfo = [ {
                            "name": "Daniel Cho",
                            "hireDate": "03/11/2016",
                            "responseDate": "03/13/2016",
                            "submitDate": "03/12/2016",
                            "authStatus": "Authorized",
                            "caseSatus": "Closed",
                            "phone": "+1 (213) 382-1115",
                            "authorized": true
                        }
    ];

                           $scope.EmployeeInfo = EmployeeInfo;

                            function initConfigurationClosedCases() {
                                sessionStorage.ModuleSelected = 'Closed Cases';
                                LoadMenuInformation();
                            }

                           }]);

在 cshtml:

   <div ng-controller="OtherController" class="other-controller">
                                <small>this is in "OtherController"</small>
                                <div class="text-center">
                                    <dir-pagination-controls boundary-links="true" on-page-change="pageChangeHandler(newPageNumber)" template-url="/Areas/EVerify/Views/EVerify/dirPagination.tpl.html"></dir-pagination-controls>
                                </div>
                            </div>

解决方法 1:

在您的布局中添加下面的元素<head>

<base href="@Url.Content("~")">

和也省略斜线 / 时引用指向一个文件,即︰

template-url="Areas/...

最后,我建议创建一个文件夹在您的项目和主机的根你角 .js.html 的文件存在。现在服务器块请求向静态文件内有机会 Areas 文件夹。

赞助商