Issue: Experiencing difficulties with Angular directive as it is being called multiple times, resulting in incorrect transaction outcomes and multiple entries on the Console screen.
Desired Outcome: Ensure that the function executes only once.
Sample code snippet
within HTML page
<div *ngIf="TEST(0)"> </div>
within .ts Page
TEST(number) {
console.log (number);
}
Outcome:
https://i.sstatic.net/WX11K.png
2 2 2 2
I have provided a simple example on the StackBlitz website.
Here is the link;
StackBlitz Link
Could this be an angular bug? Or is there something I am missing?
Appreciate your insights in advance.