a8m / a8m/angular-filter

Initial/Default value in ng-repeat

Đang mở
#185 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
2.9k
Fork
319
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.