Angular has the following HTML and components:
The IconInfo class has an icon and icon name.
When the button is pressed from the screen, addIconInfo is called and
Each time a button is pressed, an icon is added to the screen.
Therefore,
in the area where icons are displayed when icons are added
From the bottom to the top (as if it were accumulating on top)
I'd like to, but is there any way?
Would it be difficult to do it with ngFor alone?
◆ HTML
<div class="page">
<section class="card">
<ng-container*ngFor="letion of icons">
<div class="media">
<img src={icon.img}}>
</div>
</ng-container>
</section>
</div>
◆ Components.ts
addIconInfo(icon:string, name:string){
This.icons.push (new IconInfo(icon, name));
}
I don't know what this.icons
looks like, but if it's simply Array
, it's not push
to add it to the end, but unshift
to add it to the beginning.
this.icons.unshift (new IconInfo(icon, name));
© 2024 OneMinuteCode. All rights reserved.