a8m / a8m/angular-filter

Initial/Default value in ng-repeat

Aberta
#185 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
2.9k
Forks
319
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.