a8m / a8m/angular-filter

Initial/Default value in ng-repeat

オープン
#185 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。