Alexandr Domoryonok Alexandr Domoryonok - 1 year ago 88
AngularJS Question

How i can do it in Angular?

i need get these behavior

ng-if='season in current_user.subscriptions'

It is necessary to check the availability of the season in the user's subscriptions , the subscription comes array.How i can i do that?

My data for current_user:
enter image description here
and for season

enter image description here
I want to show the item when the array user subscriptions present this season

Answer Source

If I understood your question correctly, I believe this is what you're looking for:

ng-if="current_user.subscriptions.indexOf(season) != -1"

This directive will render the element only if the season is included inside the array current_user.subscriptions. Please do check all necessary values are available in the $scope.

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