Created
March 4, 2015 18:08
-
-
Save metalmatze/b02ad7979baff82adb60 to your computer and use it in GitHub Desktop.
GET image and display base64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$http.get(url, { | |
headers: | |
Authorization: 'Bearer ' + authenticationService.getToken() | |
responseType: 'arraybuffer' | |
}) | |
.success((data) -> | |
image = new Image() | |
reader = new FileReader() | |
blob = new Blob([data]) | |
reader.onloadend = -> | |
image.src = reader.result | |
reader.readAsDataURL(blob) | |
element.append(image) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment