I am looking for a solution that lets me use either ng-repeat
or collection-repeat
for a repeating list depending on a set variable.
I understand there are the following possibilities:
- Use dynamic templates and load the right template at run time
- Potentially use
ng-attr
I want to avoid 1, because I don't want two templates - I'll have to keep updating code in both.
As far as 2 is concerned, it does not look like I can apply it to directives that pass parameters (Angular - Use attribute directive conditionally)
What I want to achieve is this:
//if $root.platformOS == "desktop"
<ion-item ng-repeat="event in events| filter:search.text" item-height="event.Event.height" id="item-{{$index}}">
//if $root.platformOS != "desktop"
<ion-item collection-repeat="event in events| filter:search.text" item-height="event.Event.height" id="item-{{$index}}">
Thank you.