How to show contact image?


#1

How could I get and display an image related to an contact?

When I pick a contact I get this field:

 "photos": [
        {
            "id": "9",
            "pref": false,
            "type": "url",
            "value": "content://com.android.contacts/contacts/2/photo"
        }
    ],

How could I use this link to show a image on screen?


#2

The problem is that angular 2 is sanitizing that url because it begins with content:// so what you need to do is inject sanitizer: DomSanitizer and then call sanitize.bypassSecurityTrustUrl(photos[0].value)