0

I've been trying to sort data from strongloop using a call from angular controller.

angular.module('fsbs')
    .controller('LocationCtrl', ['$scope', '$state', '$window', 'Location',
    function ($scope, $state, $window, Location) {
            $scope.dataset = [];    
            function get() {
                Location
                    .find({
                        order: "name ASC"
                    })
                    .$promise
                    .then(function (data) {
                        $scope.dataset = data;
                    })
            }
            get();
}])

The request sent using the lb-service is:

http://localhost:3001/api/locations?order=name+ASC

The request sent using the explorer is:

http://0.0.0.0:3001/api/locations?filter=%7B%22order%22%3A%22name%20asc%22%7D

Even though I'm getting the data, it's not sorted. My question is, Why is lb-service generating such a request? Is there anything wrong in my controller?

Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48

1 Answers1

0

Okay, sorry for posting the question. I'm not deleting it, since it may be useful for others who might make the same mistake.

I got the sorted data when I changed the code to the following:

                .find({
                    filter: {
                        order: "name asc"
                    }
                })
Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48