Angularfire2 How check if a key exists in the database through HTML IONIC2

6 views
Skip to first unread message

aditya mudunuri

unread,
Jul 23, 2017, 3:10:23 AM7/23/17
to Angular and AngularJS discussion

I am new to this, please forgive me if i have done something wrong but here is my question.

I am trying to hide a profile if its contains a certain key in one of its child lists. But this key is dynamic is different for different user.

Here is a sample of how my data is structured

userProfile{
   ....
   profile: {
    name:"SOMENAME",
    jList: {
      1ERT3VFDAFSDGWGK: {keys: values},
      1DFEVGJICN4CF5FG: {keys: values},
    }
   }
}

HERE is my html:

So Here I am trying to hide any profile whose list contains jId key in it.

<ion-card ionic-button padding *ngFor="let p of profileList | async" (click)="goToProfilePage(p.$key, p.PhNum)"
[class.hide]="p.profile.jList.$jId !== null">
  <ion-label contenteditable=""class="bungee"><strong>{{p.profile.name}}</strong></ion-label>
  <br/>
  <p>Tap to view worker profile</p>
  <br/>
</ion-card> 



export class ListProfilePage {
    public jId: any;
    ....
 }

So the gist of the story is i am trying to check if the value in jId variable is present in the profile's jlist, if it is already there then hide it so that they don't see it again. ( As a sample jId would contain "1ERT3VFDAFSDGWGK" string in it).

My main question is how do i read the jId variable and concatenate it to the profile item to access it in the html.

Reply all
Reply to author
Forward
0 new messages