I am using isteven-multi-select to output an array of objects from a select element's multiple selections.
[ { category: "Adventure", ticked: true }, { category: "Strategy", ticked: true } ]
2. Then using angular.forEach to change the array of objects into an array of the category values.
$scope.testOutput = function () {
angular.forEach($scope.output, function(value, prop, obj) {
var categoryFiltered = [];
categoryFiltered.push(value.category);
console.log(categoryFiltered);
});
};
categoryFiltered = ["Adventure", "Strategy"];
3. Now I need to use the categoryFiltered array to filter out the other categories in an ng-repeat.
HTML
ul
li(ng-repeat='item in items | filter: {categories: categoryFiltered')
MongoDB populating items
{
year: 1962,
categories: ["Adventure"]
}, {
year: 1972,
categories: ["Fishing"]
}, {
year: 1982,
categories: ["Strategy"]
}
What is the best way to achieve this?