a8m / a8m/angular-filter

Initial/Default value in ng-repeat

未關閉
#185 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
2.9k
分支
319
PR 合併指標
30 天內沒有已合併 PR

描述

My code:

```
User 1 {{value}}

```

Scenario:
I use combination of filterBy and countBy filter to get drop down value. The default drop down value is set to **User 1**, its changes when the user selects a value from drop-down and later the value can never be **User 1** Example (Default value is User 1 drop-down value is hi,hello,hey. Once user selects either of these values the ddvalue1 field gets updated in DB and user can in future only select value available in drop-down)

The purpose of using the filter above is to display a badge. As the user selects the value from drop down the badge value decrease. Example I have 5 drop-down all set to User 1 initially, hence badge value is 5, once a new drop-down value is selected the the badge value decreases to 4.

The problem is when **all** the value of drop down is changed the filterBy filter can't find User 1 and as such the count value is not updated. So instead of getting 0 nothing gets displayed. Is there a way to set default values ?

I tried my best to explain, i have attached image as well. I have written same filter for another drop-down, the only thing changes is default value to **User 2.** As u can see in the image the panel should display value of badges as 1 and 0 for user 1 and user 2 respectively, but since it can't find the filter it displays nothing. I tried using tertiary operator while displaying the output but im not sure what should i compare the *_value *_ too {{ value > 0 ? value : 0}}

![upload](https://cloud.githubusercontent.com/assets/8932939/12692041/fa8077f4-c6a6-11e5-8bc1-e20c11537e60.JPG)

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。