1

I am getting byte array from api and i have applied image tag on my HTML page as <img src="data:{{model.asd_logo_type}};base64,{{model.dfgh_logo}}" alt="...">

but i am not able to get the image on display.

Please suggest what can i do.

2
  • try model.dfgh_logo.join() Commented Feb 14, 2018 at 7:49
  • Have you considered that your type and binary code are broken or have typo? Have you seen how img tag looks like in dev tools? Commented Feb 14, 2018 at 8:50

1 Answer 1

5

you can use src directive to display image in angular

<img [src]="'data:image/jpeg;base64,'+model.dfgh_logo" />

This is how I achieved. model.dfgh_logo this should have image in byte array.

Sign up to request clarification or add additional context in comments.

3 Comments

please try updated answer. If this doesn't work then please let me know which value you are getting in this variable model.asd_logo_type
in logo type i am getting "image/jpeg" and in model.dfgh_logo i am getting "blob data in buffer"
This worked for me. I have no idea what's up with the down votes

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.