Angular Url-template throws无法找到资源

时间:2016-04-25 22:32:38

标签: jquery html angularjs

我正在尝试在我的页面上实现分页,我收到以下错误。

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

js file:

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 个答案:

答案 0 :(得分:1)

在布局的<head>

中添加以下元素
<base href="@Url.Content("~")">

并在引用文件时省略斜杠/,即:

template-url="Areas/...

最后,我建议在项目的根目录中创建一个文件夹,并在那里托管您的角度.js.html文件。服务器有可能阻止对Areas文件夹中的静态文件的请求。