我有一个 Angular 8 应用程序和一个搜索表单。所以我可以像这样过滤来自服务的数据:this.participantService.filterParticipantsByRegistration(1, "Invited", moment(this.startDate).format('YYYY MM D')).subscribe(result => { console.log(this.startDate.toString()); console.log(result);});我看到正确的数据是这样的:7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]0: {participantId: "1df0b475-d463-47ba-29a4-08d6ce7e67a4", email: "gjbh9@idmatica.nl", fullName: "Gert-Jan Boesschen Hospers", firstName: "Gert-Jan", lastNamePrefix: "", …}1: {participantId: "6f5d3210-5650-41bd-bfb0-08d6d23579f3", email: "gjbh11@idmatica.nl", fullName: "Gert-Jan Boesschen Hospers", firstName: "Gert-Jan", lastNamePrefix: "", …}2: {participantId: "e6fb0137-d21e-419b-bfb1-08d6d23579f3", email: "gjbh12@idmatica.nl", fullName: "Gert-Jan Boesschen Hospers", firstName: "Gert-Jan", lastNamePrefix: "", …}3: {participantId: "ba645f8c-3b53-44d4-bfb2-08d6d23579f3", email: "gjbh15@idmatica.nl", fullName: "Gert-Jan Bosch但是我的问题是,如何在材质网格中显示console.log?
1 回答
红糖糍粑
TA贡献1815条经验 获得超6个赞
您分配.subscribe方法的返回值,即订阅,但您需要结果,所以只需在.subscribe 中执行
searchFor(part: ParticipantInfoDTO) {
this.participantService
.filterParticipantsByRegistration(1, "Invited", moment(this.startDate).format("YYYY MM D"))
.subscribe(result => {
this.datasource.filter = result;
});
}
添加回答
举报
0/150
提交
取消