let what = ''
let order = ''
return _.orderBy(f,[function(o) {
switch(form.sortOrder) {
case "Alphabetic" :
what = o.title;
order = 'asc';
break;
case "Popularity" :
what = o.popularity;
order = 'desc';
break;
case "Revenue" :
what = o.revenue;
order = 'desc';
break;
case "Release Date" :
what = o['release date'];
order = 'desc';
break;
}
return what }], order)
When the form is used to change the sort order, it doesn’t change the order and sticks with ‘asc’ sorting.