Will too much of ngIf statment in one page in ionic will degrade application speed and performance?


#1

I am working in an Ionic Application and I got I stuck with two choices either to build every single page for each UI design or use dynamic main page with if else condition in html files .

....

.. .... APPLY NOW
<div *ngIf="role == 'somethingtwo';">
  <ion-row text-center>
    <p>     ....      </p>
  </ion-row>
  <ion-list>
    <ion-item no-lines ngFor="let two of tow | async; let ..">
        ..
      ....
   </ion-item>
 </ion-list>

<button ion-button block (click)=“doSomeThing(‘somethingtwo’)” color=“core”>APPLY NOW

Also Please consider the TS file.

Is it good practice? Will the performance of application degrade if I follow the above concept

Please share me your advice

Thanks…


#2

The answer to the question in your title is yes. Use ngIf strategically.

But how long is your list? 5 items? Probably does not matter. Do you use ngIf 20 times on a page? Might be a problem.


#3

Thanks for advice. I will try to do both way and confirm myself. That will be good experience…