2016-12-30 58 views

回答

0

得到任何信息這可能只是一個解決辦法,因爲我找不到任何東西在他們的github頁獲得獨特的價值。 我繼續訂閱它,推它,如果不存在,就救了它在另一個數組:

employees : FirebaseListObservable<Employee[]>; this.employees = af.database.list('/employees'); this.departments=[]; 


    this.employees.subscribe(
    x =>{  
     x.forEach(element => { 
     if(!this.departments.includes(element.department)) 
     { this.departments.push(element.department);} 

    });   
    } 
); 

,現在我可以用我的選擇是這樣的:

<select name="depts" id="" #d (change)="filterBy(d.value)"> <option *ngFor="let d of departments" [value]="d">{{d}}</option></select> 
+0

是還有另一種做法嗎? – niklas