Question

i want to do multiple filter on angularjs using lb-services like this

  MasterTrip.find({ 'filter[include]':'froms',
                      'filter[include]':'tos',
                      'filter[include]':'trips'},function(respon){
      console.log(respon);
      $scope.masters = respon;
    });

but i got this error message

Uncaught SyntaxError: Duplicate data property in object literal not allowed in strict mode

how to fix that. any alternative to do multiple filter?

Était-ce utile?

La solution

You can use the same javascript-object-based syntax as you would in your server-side code:

MasterTrip.find(
  { filter: { include: ['froms', 'tos', 'trips'] } },
  function(respoonse) {
    // etc.
  });

The URL will contain a single query parameter filter with a JSON representation of the object. If you prefer to keep the URL query expanded, you can use the following code:

MasterTrip.find(
  { 'filter[include]': ['froms', 'tos', 'trips'] },
  function(response) {
    // etc.
  });
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top