export class Component implements OnInit {
constructor(
private router: Router,
private userService: PostGetService,
private _Activatedroute: ActivatedRoute
) {}
ngOnInit() {
this.categoryId = this._Activatedroute.snapshot.params['categoryId'];
this.userService.searchListingById(Number(this.categoryId))
.subscribe(res => {
this.rawdata = res.json();
console.log(this.rawdata)
});
}
}
我有一个下拉菜单,我将在其中选择一个类别,然后基于该类别,我想在另一页上显示其相关数据
我有这样的答复,即我需要在下一页上显示这些详细信息
[{
"id": 45,
"installerTitle": "Test112",
"firstName": "Test112",
"middleName": "Test112",
"lastName": "Test112",
"emailId": "Test112",
"contactNo": "Test112",
"password": "Test112",
"installerType": "Test112",
"keywords": "Test112",
"status": "Test112",
"isActive": 2,
"desc": null,
"installerlocation": [{
"installerLocationId": 12,
"addresslineOne": "Test112",
"addresslineTwo": "Test112",
"addresslineThree": "Test112",
"city": "Test112",
"state": "Test112",
"zipcode": "Test112",
"gecodeX": 2,
"gecodeY": 2,
"isActive": 2,
"status": "Test112"
}],
"installerPayment": [{
"installerPaymentId": 16,
"installerStripeId": "cus_DdJsIWh9ake0Bc",
"installerAmt": null,
"status": 1
},
{
"installerPaymentId": 16,
"installerStripeId": "cus_DdJsIWh9ake0Bc",
"installerAmt": null,
"status": 1
},
{
"installerPaymentId": 16,
"installerStripeId": "cus_DdJsIWh9ake0Bc",
"installerAmt": null,
"status": 1
}
],
"installersocial": [{
"installerSocialId": 11,
"socialType": "Test112",
"socialUrl": "Test112",
"facebookUrl": "Test112",
"twitterUrl": "Test112",
"vkontakeUrl": "Test112",
"whatsappUrl": "Test112"
}],
"installerworktiming": [{
"installerTimeId": 12,
"locationId": 2,
"dayId": 2,
"timeFrom": 2,
"timeTo": 2,
"isHoliday": 2,
"timeSunday": "Test112",
"timeMonday": "Test112",
"timeTuesday": "Test112",
"timeWednesday": "Test112",
"timeThursday": "Test112",
"timeFriday": "Test112",
"timeSaturday": "Test112"
}],
"installerserviceModel": [{
"installerServiceId": 13,
"category": {
"categoryId": 35,
"categoryName": "Test101",
"categoryDesc": "Test101",
"categoryServicemodel": [{
"serviceId": 8,
"serviceName": "Test101",
"serviceDesc": "Test101",
"isActive": 1
}],
"active": 1
},
"categoryServiceModel": {
"serviceId": 8,
"serviceName": "Test101",
"serviceDesc": "Test101",
"isActive": 1
}
},
{
"installerServiceId": 12,
"category": {
"categoryId": 17,
"categoryName": "Test98",
"categoryDesc": "Test98",
"categoryServicemodel": [{
"serviceId": 7,
"serviceName": "Test98",
"serviceDesc": "Test98",
"isActive": 8
},
{
"serviceId": 13,
"serviceName": "Test115",
"serviceDesc": "Test115",
"isActive": 1
}
],
"active": 8
},
"categoryServiceModel": {
"serviceId": 7,
"serviceName": "Test98",
"serviceDesc": "Test98",
"isActive": 8
}
},
{
"installerServiceId": 11,
"category": {
"categoryId": 7,
"categoryName": "Test Name",
"categoryDesc": "Test Description",
"categoryServicemodel": [{
"serviceId": 6,
"serviceName": "serv name test",
"serviceDesc": "serv desc test",
"isActive": 1
}],
"active": 0
},
"categoryServiceModel": {
"serviceId": 6,
"serviceName": "serv name test",
"serviceDesc": "serv desc test",
"isActive": 1
}
}
]
}]
这些是我想获得的类别ID选择之一的详细信息,我不想在一些详细信息(例如姓名,电子邮件,联系电话)上显示所有详细信息。
答案 0 :(得分:0)
首先我在service.ts文件中创建了服务
compileJava
从这里我将传递选定的下拉ID以基于该选定ID进行搜索 ....然后我从我的component.ts文件
中调用上述服务方法
compileTestJava
,值将存储在categoryRawdata变量中,并使用此变量存储在component.html绑定值中