Currently delving into Angularjs and have a quick query:
I recently received an array from a user which looks like this:
userPreferences = [7,5,4]
Additionally, I am working with an object that uses ng-repeat to showcase various news items. The object structure is as follows:
{
"id": 1,
"preferences": [
3,
4
]
}
My goal is to utilize the array retrieved from user preferences within my ng-repeat function in order to sort the news articles by displaying the preferred ones first, followed by the remaining news. Is this achievable?
Would something along these lines work:
<li ng-repeat="new in news | filter:{'userPreferences' : new.preferences}">
I'm not entirely sure whether I should be using filter, orderBy, or sort for this task. Any assistance would be greatly appreciated!