Ng-if id != null

Hi
I need to show an element only if the user is logged in (which means that the user should have an id stored in his device)
here is my html component :

ion-card-title ng-if="id != null">write a review</ion-card-title>
        <form [formGroup]="reviewForm" (submit)="writeReview($event)">
          <ion-list>

            <ion-item>
              <ion-input type="text" formControlName="name" placeholder="name"></ion-input>
            </ion-item>
            <ion-item>
              <ion-input type="text" formControlName="review" placeholder="review"></ion-input>
            </ion-item>
            <ion-item>
              <ion-label>rating</ion-label>
  <ion-select formControlName="rate">
    <ion-option value="5">5</ion-option>
    <ion-option value="4">4</ion-option>
    <ion-option value="3">3</ion-option>
    <ion-option value="2">2</ion-option>
    <ion-option value="1">1</ion-option>
  </ion-select>
            </ion-item>
          </ion-list>
          <button ion-button color="secondary" block type="submit" >add your review</button><br />
        </form>
    </ion-card-content>
  </ion-card>

ng-if is Angular 1 syntax, so you want *ngIf instead. JavaScript’s notion of null and undefined and so on is so baroque that I recommend steering well clear of it and would do *ngIf="!!id" instead.

@keloa Hi Keloa, in terms of app design, I wonder why you check if the user is authenticated only at this stage in your code (template view)?

Can’t you check before in the .ts file or better the provider, if your user is granted permission? Not to mention, it will be easier to debug and lighten page processing.

This seems like a perfectly reasonable design to me. You show the same page to guests and authenticated users, only certain features are omitted in the guest case.

Alright if this view is open both to guests and registered users.

I want the guests to be able to see the reviews whereas the users can see and write the reviews , (to limit the spammers and it is useful in some future updates)