Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ng2分页加载资源失败:服务器响应状态为404(未找到)_Angular_Typescript_Asp.net Core Mvc - Fatal编程技术网

Angular ng2分页加载资源失败:服务器响应状态为404(未找到)

Angular ng2分页加载资源失败:服务器响应状态为404(未找到),angular,typescript,asp.net-core-mvc,Angular,Typescript,Asp.net Core Mvc,我正在尝试实现分页。我调用了web api,它返回了1000多万条记录。当我实现ng2分页时,它显示了这个错误 加载资源失败:服务器响应状态为404(未找到) 我包括ng2分页包,还提供了index.html文件的参考 eventlog.component 从'angular2/core'导入{Component,OnInit}; 从'rxjs/Rx'导入{Observable}; 导入'rxjs/add/operator/map'; 导入'rxjs/add/operator/do'; 从'

我正在尝试实现分页。我调用了web api,它返回了1000多万条记录。当我实现ng2分页时,它显示了这个错误

  • 加载资源失败:服务器响应状态为404(未找到)
我包括ng2分页包,还提供了index.html文件的参考

eventlog.component
从'angular2/core'导入{Component,OnInit};
从'rxjs/Rx'导入{Observable};
导入'rxjs/add/operator/map';
导入'rxjs/add/operator/do';
从'angular2/Http'导入{Http,Http_提供者};
从“../../node_modules/ng2 pagination”导入{PaginatePipe,PaginationService,PaginationControlsCmp,IPaginationInstance};
导出接口页面响应{
总数:个;
数据:T[];
}
导出接口数据模型{
id:编号;
资料来源:字符串;
级别:字符串;
类别:字符串;
日期:任何;
}
@组成部分({
templateUrl:“./appScripts/layout/eventlog.html”,
选择器:“事件日志”,
提供者:[HTTP_提供者,分页服务],
指令:[分页控制SCMP],
管道:[分页管道]
})
导出类EventLogComponent实现OnInit{
私有数据:可观察;
专用页:编号=1;
私人(总人数):;
构造函数(私有的http:http){
}
//从服务器调用api
getPage(第页:编号){
this.\u data=this.\u http.get(“http://localhost:54363/api/data/“+页码+”/10”)
.do((res:any)=>{
这个。_total=res.json().total;
本页=第页;
})
.map((res:any)=>res.json().data);
}
恩戈尼尼特(){
这是第(1)页;
}
}
我的节点的Dir_模块 单击链接以查看图像

您没有说,但我假设您正在使用SystemJS加载模块。如果是这样,您需要确保将文件
ng2 pagination bundle.js
包含在
index.html
文件中(即在
标记中)

然后,当您想在组件中导入它时,只需执行以下操作

import {PaginatePipe, PaginationService, PaginationControlsCmp, IPaginationInstance} from 'ng2-pagination';

您可以在这里看到SystemJS的一个工作示例:

您没有说,但我假设您正在使用SystemJS加载模块。如果是这样,您需要确保将文件
ng2 pagination bundle.js
包含在
index.html
文件中(即在
标记中)

然后,当您想在组件中导入它时,只需执行以下操作

import {PaginatePipe, PaginationService, PaginationControlsCmp, IPaginationInstance} from 'ng2-pagination';

您可以在此处看到SystemJS的一个工作示例:

是否检查了localhost上的服务是否在端口54363上运行?是的,端口正在运行。存在相同的问题。。。你明白了吗?(索引):46错误:错误:XHR错误(404未找到)在此处加载库的作者(…)。您使用什么构建模块加载系统?(webpack、systemjs、browserify?)请提供详细信息。看起来可能是配置问题。是否检查了localhost上的服务是否在端口54363上运行?是的,端口正在运行。存在相同问题。。。你明白了吗?(索引):46错误:错误:XHR错误(404未找到)在此处加载库的作者(…)。您使用什么构建模块加载系统?(webpack、systemjs、browserify?)请提供详细信息。看起来可能是配置问题。