Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Last active December 22, 2015 02:18
Show Gist options
  • Select an option

  • Save clouddueling/6402014 to your computer and use it in GitHub Desktop.

Select an option

Save clouddueling/6402014 to your computer and use it in GitHub Desktop.
angularjs complex logic in template.
<div
ng-repeat='goal in userGoals[user.id]'
ng-class='{
"grass-light":
(
goal.recurrence == "daily" &&
goal.progress >= 100 &&
goal.timeframe.indexOf(main.day - 1) > -1
) ||
(
goal.recurrence == "weekly" &&
goal.progress >= 100
),
"aqua-light":
(
goal.recurrence == "daily" &&
goal.progress < 100 &&
goal.timeframe.indexOf(main.day -1) > -1
) ||
(
goal.recurrence == "weekly" &&
goal.progress < 100 &&
((main.day - 1) >= goal.start_day && (main.day - 1) <= goal.end_day)
),
"cloud-light":
(
goal.recurrence != "weekly" &&
goal.timeframe.indexOf(main.day -1) == -1
) ||
(
goal.recurrence == "weekly" &&
((main.day - 1) < goal.start_day || (main.day - 1) > goal.end_day)
)
}'
class='module module-square pull-left'>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment