this._userService.getUsers().subscribe((userData) =>
this.users = userData.filter((x, i, a) => x && a.indexOf(x) === i));
I tried using this with the algorithm that it returns the unique values when the index of the object is the same as the first index of the object in the array. But it doesnt seem to work? I know how to filter based on certain condition i.e. user.age > 20. But how do I filter unique values in Angular for a drop down list, i.e. Male and Female?