Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  57] [ 3]  / answers: 1 / hits: 99274  / 10 Years ago, wed, march 26, 2014, 12:00:00

Seems like a very basic question but I can't get the syntax right..



<li class=list-group-item ng-repeat=question in newSection.Questions | filter:Id != '-1';  ng-mouseenter=hover = true ng-mouseleave=hover = false>
<div href=# editable-text=question.Text>{{question.Text}}</div>
</li>


All I want is to show all the questions where id is NOT -1.
What am I doing wrong. Thanks!


More From » angularjs

 Answers
19

The syntax is just a little off, try:



<li class=list-group-item
ng-repeat=question in newSection.Questions | filter:{ Id: '!-1'}
ng-mouseenter=hover = true ng-mouseleave=hover = false>

<div href=# editable-text=question.Text>{{question.Text}}</div>
</li>


See a little JSFiddle: http://jsfiddle.net/U3pVM/3845/



Edit:



Example with variables:



<script> var invalidId = '-1'; </script>
<li class=list-group-item
ng-repeat=question in newSection.Questions | filter:{ Id: '!' + invalidId}
ng-mouseenter=hover = true ng-mouseleave=hover = false>

<div href=# editable-text=question.Text>{{question.Text}}</div>
</li>

[#71771] Monday, March 24, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
iliana

Total Points: 246
Total Questions: 109
Total Answers: 82

Location: Palestine
Member since Tue, Jul 20, 2021
3 Years ago
;