I'm learning Angularjs and I have a small question:
I have the following array returned from user
userPreferences = [7,5,4]
I have an object that I'm using ng-repeat to display all news and looks like this:
{
"id": 1,
"preferences": [
3,
4
]
}
So, I want to use in my ng-repeat, the array returned from user preferences, and sort the news displaying the preferences first, then below the other news, is that possible?
Something like:
<li ng-repeat="new in news | filter:{'userPreferences' : new.preferences}">
I don't really know if I have to use filter, orderBy or sort, any help please?
new.preferencesarray has all the elements ofuserPreferences, you want to show them is it?