mercredi 22 janvier 2020

Problem in displaying images from local storage in another page

i'm new to angular development and not used to web development. I couldn't able to display the images stored in local storage in another page

<tr *ngFor = "let item of unused; let i = index ; ">
                        <div   style="padding-left:25%;padding-top:0%;"  class="row">
                            <img  src="" id="imageID" style ="
                              width: 100%;
                              height: 100%;padding-right: 50px;padding-bottom: 15px;" >
                        </div>
                    </tr>

I declared the array variable globally and also used in ngOnit like this

unused=[1,2,3,4,5]

for (let i=0; i<5;i++)
    { 
      var n = i.toString();

      var dataImage = localStorage.getItem(("image"+ n));
      var bannerImg = document.getElementById(("imageID"+n)) as HTMLImageElement;
      bannerImg.src = dataImage;
    }

Aucun commentaire:

Enregistrer un commentaire