0

HTML code:

<button type="button" (click)="callJoke()">Get joke</button>
<h1>{{msg[1].joke.value}}</h1>

JSON data:

{  
   "type":"success",
   "value":{  
      "id":533,
      "joke":"The Chuck Norris Eclipse plugin made alien contact.",
      "categories":[  
         "nerdy"
      ]
   }
}

msg is an Object that im getting from API response

1
  • 1
    Try msg.value.joke since msg is not an array Commented Aug 17, 2017 at 15:30

1 Answer 1

1

Try using an angular json pipe:

<h1>{{msg.joke.value | json}} </h1>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.