There is a simple Angular web app that uses ng-template. It uses ngTemplateOutlet directive. A handler method (loadtemplate) is set for this directive, but this method is called multiple times when a user clicks Add button.
Component html code
It’s not clear for me why it happens. I mean why it occurs multiple times if users collection is empty. Could somebody please explain it?
Component typescript code
Here is the link to the app
https://stackblitz.com/edit/stackblitz-starters-q2tper?file=src%2Fapp%2Fapp%2Fapp.component.html
I tried to find similar questions on stackoverflow,but didn’t get any results.
el3ment90 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.