Error Duplicating a data property in an object literal is not allowed in strict mode

I want to make some filters on angularjs using lb services like

  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 is not allowed in strict mode

How to fix it. any alternative to perform multiple filters?

+4
source share
1 answer

You can use the same syntax based on a javascript object as in your server code:

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

URL- filter JSON . , URL , :

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

Source: https://habr.com/ru/post/1540520/


All Articles