Problem when displaying image inside modal

Asked

Viewed 98 times

3

I need to display a list of selected images in a modal, but it is displayed only after clicking (focusing) somewhere in the modal.

Excerpts from the code:

HTML:

<label>Imagens: </label>
<fieldset class="">
    <div class="divImg" ng-repeat="item in modelCheckList.listImagens" id="ID_{{item.nome}}" ng-click="">
        <img width="40px" height="30px" src="{{item.imagem}}">
        <button ng-click="removeImg($index)" type="button" class="botaoCancelaImg"><span
                aria-hidden="true">x</span></button>
    </div>
</fieldset>

Controller:

Promise.all(promises).then(fileContents => {
for (let index = 0; index < fileContents.length; index++) {
    $scope.modelCheckList.listImagens.push({ id, idCheckList, 'base64': fileContents[index], nome: nomeArq[index]})
}
});
  • 1

    Without its complete code it is difficult to help. I believe it is a very common problem of Angularjs itself. Try to give a $scope.apply() after the is, this should force the angular to update the values.

  • @edsonalves These excerpts are the only parts that involve filling in the list and displaying in the modal. But that was it, thank you!

  • It’s just that in this case you could only be sure by testing the whole code. I’m glad it worked out! Dispose.

  • Try using ng-src="{{image}}" in place of src="{{image}}".

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.