Ion-slider + ngfor + ngif


Hi i want to create a slider from a list of users from firebase and i dont want to include in the list the user who is viewing the list…so here is my code: (Users is an angularfire observable)

<ion-slides [options]="slideOptions">
    <ion-slide *ngFor="let user of users | async" (click)="ionSlideTap()" *ngIf="user.$key !== uid">

But throws an error that i cant use ngfor and ngif in the same element…If i try to put the ngif inside a , it works but i have a blank slide which i dont want…

Is there any solution for this scenario?

I have also tried filtering with a pipe :
<ion-slide *ngFor="let user of (users | async | filter:uid)" (click)="ionSlideTap()">

and my pipe is this:

export class Filter {
  transform(users: Array<any[]>, uid: String): Array<any[]> {
    function filterByID(user) {
      if (user.$key != Number(uid)) {
        return true;
    return users.filter(filterByID);

But i get a blank screen.

Any help?


The *xxx syntax is sugar that I have found to be relatively problematic, so I tend to avoid it. You can do so with the following constructs:

<template ngFor let-user [ngForOf]="users | async">
<template [ngIf]="user.$key !== uid">


Yes it works! Thanks! Damn i spent 3 hours trying with 1 template and filters :smiley: Thank you so much!