My *ngIf statement has problems


I am trying to list all data from my firebase database where the logged in facebook user’s email address is the same as the email found in the database:

The following code is not working, lots of formatting issues, no idea how should i rewrite this

 <ng-container *ngFor="let item of fogasadatok; let i = index">
    <ion-card *ngIf="{{item.useremail}}=={{}}">

        <img src="{{item.keplink}}"/>
              {{item.datum}} - Ponty



There’s no need to use interpolation in *ngIf, so remove the brackets.
*ngIf="item.useremail =="

You should also use the [] syntax for binding to an image source:
<img [src]="item.keplink"/>

I’d also recommend moving the email logic to the controller, and making it so that fogasadatok only contains the items you actually want to display, which remove the need for the *ngIf.


Thank you, it is working now!
I tried moving the email thing to the constructor like this:

    this.firebasedb.list("/fogasok/").subscribe(_data => {
     if (_data.useremail==this.navParams.get("facebookemail")){

      } else{

      this.fogasadatok = _data;


But i cant really get the useremail from the _data, however i can see it in the object from the log:


You’d want to write something like this:

    this.firebasedb.list("/fogasok/").subscribe(_data => {
      this.fogasadatok = _data.filter(item => item.useremail == this.navParams.get("facebookemail"));

(Apologies, I don’t know what ‘fogasadatok’ means so I just used ‘item’)