I'm trying to figure out what is happening in my program and I really don't understand. Before I jump to the problem, for the purpose of this question I simplified the code and I conducted some tests, to make sure that I localized the problem.
So, in my component.html
file I have this piece of code:
<div *ngFor="let item of entityDetails | keyvalue">
<div *ngIf="hasConflict(item.key)">text</div>
</div>
As you can see I'm using *ngFor
together with Angular KeyVauePipe
and inside I check a condition using *ngIf
.
Entity Details
is a json that I get through http
request using Promise
and it looks like this:
{rcn: "1912330", name: "Barcelona supercomputing Center", vatNumber: "ESS090000099D", category: "Research Organisation", categoryCode: "REC"}
In component.ts
, the declaration:
public entityDetails: string[] = new Array();
and the retrieving the data:
this.service.getEntityDetails().then(data => {
this.entityDetails = data;
});
In hasConflict
method, all I do is printout:
hasConflict(item): Boolean {
let check: boolean = false;
console.log("test");
return check;
}
When I run it and open the console, I can already see a bunch of printouts:
but then once I click anywhere on the website or I use scroll, they intensify, after one mouse click:
after quick scroll:
Any help will be appreciated.