Ravi Patel Ravi Patel - 1 year ago 73
JSON Question

Print Data from JSON Array in Template from Component

Here is My API Call and getting response in this.order.info

response => {
this.order_info = response.json();
error => {
return error.text();

And My Response is

"table1": [
"store_name": "Your Store",
"store_url": "http://localhost:8080/upload/",
"date_added": "2016-11-18T07:51:53.000Z",
"payment_method": "Cash On Delivery",
"shipping_method": "Flat Shipping Rate",
"firstname": "q",
"lastname": "q",
"Customer_Group_Name": "Default",
"email": "q@g.com"
"table2": [
"Customer_Notified": "NO",
"date_added": "2016-11-18T07:51:54.000Z",
"comment": "",
"name": "Pending"

How I get table1.store_name in my template from component.ts

Answer Source

You should get that value like this:

<p>{{ order_info?.table1[0].store_name }}</p>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download