I want to display individual value of json object into form in angular. How to do that?
output
{
"Order": {
"active": true,
"Orders_Entrydate": "2017-12-31T18:30:00.000Z",
"LastTouchDateTime": "2018-05-10T05:46:38.702Z",
"_id": "5af07544eb26f918e0e2ff74",
"Orders_Name": "Test1",
"Orders_Number": "1011",
"Orders_LoanNumber": 1328,
"Orders_PropertyAddress1": "test address1",
"Orders_PropertyAddress2": "test address 1",
"Orders_PropertyCity": "testCity",
"Orders_Propertyzipecode": 1236,
"Orders_Countyfee": 500,
"Orders_Additionalfee": 100,
"Orders_Customerpricing": 150
}
}
view-order.ts
export class countyViewOrderComponent implements OnInit {
orders: any[];
constructor(private orderService: countyvieworder, private router: Router, private cookie_service: CookieService) {
}
getorder() {
this.orderService.getOrders().subscribe(response => {
this.orders = response.json();
})
}
onSelect(selectedItem: any) {
this.cookie_service.put('key', selectedItem._id)
// this.cookie_service.get('key')
this.router.navigate(['pages/home/County/orderEntrybyCounty']);
}
ngOnInit() {
this.getorder()
}
}
getOrderbyOrderNo() service
getOrderbyOrderNo() {
this.id = this.cookie_service.get('key');
return this.http.get('http://localhost:8080/View/'+ this.id)
}
Getting this error:
Argument of type 'Response' is not assignable to parameter of type 'string'.
orderService.getOrderbyOrderNo()code as well. There is a type mismatch. What is the type of the response being returned bygetOrderByOrderNo?this.ordersHttpModuleorHttpClientModule