kennechu kennechu - 2 years ago 246
AngularJS Question

Slice ng-repeat with AngularJS

An easy question from a noob in Angular.

I have my ng-repeat like this:

ng-repeat="f in drillDownList['D' +
d.merchMetrics.DEPT_NBR + 'CG' +
d.merchMetrics.CATG_GRP_NBR + 'C' +

and I want to slice the last record because it's alway empty and it comes like that from the WS but I dont know how to achive this in AngularJS.

Answer Source

Inside ng-repeat you have available a variable $last.


<div ng-repeat="item in [1,2,3,4]">
  <div ng-if="!$last">{{item}}</div>

See more

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download