myput
myput

Reputation: 422

AngularJS: condition in ng-repeat directive

I would like like to know how can i set a condition in a ng-repeat who is in a directive call:

<map-marker ng-repeat='obj in objects'
  title=      'obj.name'
  latitude=   'obj.last_point().latitude'
  longitude=  'obj.last_point().longitude'
  click=      'state.toggle_selected(obj)'
  icon=       'obj.toggle_icon()'>
</map-marker>

I would like to set a marker for my map only if the obj has last_point(). kind of:

<map-marker ng-repeat='obj in objects' ng-if='obj.last_point()' ...

My map-marker is a custom directive.

I can't find a solution. Do you know how I can do that please?

Thanks for help

Upvotes: 1

Views: 1396

Answers (1)

Nox
Nox

Reputation: 246

What about pre-filter the list in order to it?

I found this in the forum, it might help you:

https://stackoverflow.com/a/14789258/1683636

Upvotes: 1

Related Questions