Timeline for Angular 8 - Dynamically added button.Click event not working
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 9:12 | history | edited | CommunityBot |
Commonmark migration
|
|
| Mar 4, 2020 at 18:14 | comment | added | Shravan |
@svkks You don't need to know the exact count of the array. Start with an empty array first and then add items to it when use clicks on Add button. In the template, just loop over the array using *ngFor directive. Using innerHTML attribute is not recommended and is not the best approach.
|
|
| Mar 4, 2020 at 17:38 | history | edited | Podge | CC BY-SA 4.0 |
Update based on comments
|
| Mar 4, 2020 at 16:35 | comment | added | svkks | array means we should defined how many but here images should added only clicking add button. | |
| Mar 4, 2020 at 16:25 | comment | added | jasonvuriker | In that case, you need an array that stores your data(image,title). in html you use *ngFor to show array data in content. when you click delete, slice from array, when you add just push to array. that's all | |
| Mar 4, 2020 at 16:16 | comment | added | svkks | Actually I need this to dynamic because multiple images should be added. Images div should be added on clicking the add button and removing by clicking the delete button. | |
| Mar 4, 2020 at 16:07 | history | answered | Podge | CC BY-SA 4.0 |