问题
I have 3 divs based on my condition. Those divs have to appear, actually it is working as expected for the first time
- div a
- div b
- div c
This is the condition I gave
<div class="pl-2 flex-grow-1 d-flex" *ngIf="getInfo!==3 && getInfo !== 5"></div>
<div class="pl-2 flex-grow-1 d-flex" *ngIf="getInfo==3"></div>
<div class="pl-2 flex-grow-1 d-flex" *ngIf="getInfo==5"></div>
Initially when I load first page first div is working as expected, no issue there. But when I got to second page the second div loaded and when again I come to first page, the second div is loading and not the first div.
Here is my TS code
const getinfo = this.caService.info.subscribe((response) => {
this.getInfo = +response
});
来源:https://stackoverflow.com/questions/64058914/angular-8-ngif-condition-not-working-as-expected