2016-04-25 35 views
0

我正在尝试在我的页面上实现分页,并且出现以下错误。Angular Url-template引发无法找到资源

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文件夹中的静态文件发送请求。