last day (15 days later) » 

21:15
1
A: AngularJS: ngIf in array of objects with different properties

Ralph WiggumIf you're trying to find if it's the last element AND if isNumber is set to true, you can use this: <span ng-repeat="item in items" ng-if="item.isNumber && $last"> $last is a special variable defined through ngRepeat, located here. Since ngIf accepts a boolean statement, you can use both the lo...

Hmm. I guess I just assumed OP was iterating over the array.
ngIf here returns true if the last element of array will be with isNumber on true. But what will be if the last element have isNumber on false? I need to disable "Down" button on the last element with true value of isNumber property. So that this element couldn't be possible to move down. I have something like this: 1, 2, 3, 4, 5, #, *. And I don't want the last element (5 in this case) have "Down" button, because i'll get smth like this: 1, 2, 3, 4, #, 5, * - it will be an error.
I updated my question.
I posted an update ("Edit 2"). Could you check if the next element in the iteration isn't a number?
Unfortunately, it doesn't work, but thank you for help.
Not sure if this helps, but you could do this to select #5: jsfiddle.net/qfpyrcot/2 -- it checks to see if the current element is a number AND the next element is not a number. In the example, it puts a '>' right next to #5.
Does that help? It just looks to see if the current element is a number and the next element isn't a number
21:19
Just one moment
I tried this solution before asking on stack, but it didn't help. Maybe now it'll help. I check it.
Look for a while, please - yadi.sk/i/taACYwzUjKsKK
And this my code - yadi.sk/i/dfnYY1hujKsMu
Magic...? Where did I make mistake?
I just need to disable that button if the current element is a number and the next element isn't a number
is the <button> in an ng-repeat?
Ohhh
Yeap
It's recursive function and button in ng-repeat
Maybe I have problem with my array
Let me check
21:35
What is data.nodes?
Do you have two variables named data? Since you're doing data.isNumber as well as !data.nodes[$index+1].isNumber
And can you post your entire ng-repeat code on pastebin or something?
Data - it's my object.
Nodes - nested objects.
21:51
Hmm... I'm really not sure
I'd try posting the entire ng-repeat code on the question and wait until someone really smart answers it haha
It works! Thanks. The problem was in ! (negation) before an array!
!list[$index+1].isNumber this give us true if that element (next) has isNumber = false. And then ng-if has true and show this button, if we remove negation, we will get false, if the next number will be false and ng-if disable our button. I hope, you undestand me ;)

last day (15 days later) »