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]})
}
});
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.– edson alves
@edsonalves These excerpts are the only parts that involve filling in the list and displaying in the modal. But that was it, thank you!
– Henrique Santana
It’s just that in this case you could only be sure by testing the whole code. I’m glad it worked out! Dispose.
– edson alves
Try using
ng-src="{{image}}"
in place ofsrc="{{image}}"
.– Ivan Ferrer