0

I'm trying to get the last item from an array in AngularJS and I tried already to get the last item using the method explained in https://stackoverflow.com/a/3216041/6653509

But I can't seem to get it working.

This is how it looks:

.test(ng-repeat="item in data[0]")
  p {{item['samenvatting hoofdmelding']}}

Now I tried it like this:

.test(ng-repeat="item in data[0]")
  p {{item[item['samenvatting hoofdmelding'].length-1]}}

But with no success

Larsmanson
  • 413
  • 1
  • 5
  • 18

1 Answers1

0

Maybe this one should work:

.test(ng-repeat="item in data[0]")   

p {{data[0][data[0].length - 1]['samenvatting hoofdmelding']}}

the thing is the last item of data[0] is data[0][data[0].length - 1]