Currently I have a foreach binding with ko with an img tag inside. I want to get this image as a src data string from an authorized web api 2 service.
These images are heavy, so I don't want to load them as src data with the model. I also don't want to directly link to them, because I want the "get" of the image to be an authorized request.
<div class="owl-carousel owl-theme" data-bind="foreach: loadedScreen().Screen_Mockup">
<img class="owl-carousel-img-util" data-bind="attr: { src: getMockupImageById(screen_mockup_id()) }">
</div>
This kinda works, but only if there is no ajax involved. If my getMockupImageById() method just returns a string, it is correctly populated.
If however I try to make an ajax request and return it from the success callback, it's not. My web service returns strings of this kind: "data:image/png;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlu..."