Is it possible to use OR statement in angular-in-memory-web-api?












0















I'm creating a prototype live search which uses angular-in-memory-web-api.



I currently have this:



createDb() {
const entities = [{
id: 11,
first_name: 'John',
last_name: 'Doe',
entity_type: 'P',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'lol'
},
{
id: 12,
first_name: 'Jen',
last_name: 'Johnson',
entity_type: 'C',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'rly'
},
{
id: 13,
first_name: 'Wendy',
last_name: 'McGee',
entity_type: 'A',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'Johnny Tightlips ltd.'
},
{
id: 14,
first_name: 'James',
last_name: 'Manson',
entity_type: 'P',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'Polar Digital'
},
{
id: 15,
first_name: 'Jack',
last_name: 'Black',
entity_type: 'A',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'HSBC'
},
{
id: 16,
first_name: 'Jen',
last_name: 'Simmons',
entity_type: 'C',
entity_role: 2,
ENTITY_STATUS: 'A',
legal_name: 'Polar Digital'
},
];
return {
entities
};
}


I want to be able to supply a query string which matches different object properties. For example: Just typing in the letter 'J' should return every row in the database I provided above.



const queryString = `?first_name=${query}&last_name=${query}`;


This won't work because it will only retrieve results which include both 'J' in both the first_name and last_name.



Is this possible? Can't seem to find anything on the docs: https://github.com/angular/in-memory-web-api










share|improve this question





























    0















    I'm creating a prototype live search which uses angular-in-memory-web-api.



    I currently have this:



    createDb() {
    const entities = [{
    id: 11,
    first_name: 'John',
    last_name: 'Doe',
    entity_type: 'P',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'lol'
    },
    {
    id: 12,
    first_name: 'Jen',
    last_name: 'Johnson',
    entity_type: 'C',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'rly'
    },
    {
    id: 13,
    first_name: 'Wendy',
    last_name: 'McGee',
    entity_type: 'A',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'Johnny Tightlips ltd.'
    },
    {
    id: 14,
    first_name: 'James',
    last_name: 'Manson',
    entity_type: 'P',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'Polar Digital'
    },
    {
    id: 15,
    first_name: 'Jack',
    last_name: 'Black',
    entity_type: 'A',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'HSBC'
    },
    {
    id: 16,
    first_name: 'Jen',
    last_name: 'Simmons',
    entity_type: 'C',
    entity_role: 2,
    ENTITY_STATUS: 'A',
    legal_name: 'Polar Digital'
    },
    ];
    return {
    entities
    };
    }


    I want to be able to supply a query string which matches different object properties. For example: Just typing in the letter 'J' should return every row in the database I provided above.



    const queryString = `?first_name=${query}&last_name=${query}`;


    This won't work because it will only retrieve results which include both 'J' in both the first_name and last_name.



    Is this possible? Can't seem to find anything on the docs: https://github.com/angular/in-memory-web-api










    share|improve this question



























      0












      0








      0








      I'm creating a prototype live search which uses angular-in-memory-web-api.



      I currently have this:



      createDb() {
      const entities = [{
      id: 11,
      first_name: 'John',
      last_name: 'Doe',
      entity_type: 'P',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'lol'
      },
      {
      id: 12,
      first_name: 'Jen',
      last_name: 'Johnson',
      entity_type: 'C',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'rly'
      },
      {
      id: 13,
      first_name: 'Wendy',
      last_name: 'McGee',
      entity_type: 'A',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Johnny Tightlips ltd.'
      },
      {
      id: 14,
      first_name: 'James',
      last_name: 'Manson',
      entity_type: 'P',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Polar Digital'
      },
      {
      id: 15,
      first_name: 'Jack',
      last_name: 'Black',
      entity_type: 'A',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'HSBC'
      },
      {
      id: 16,
      first_name: 'Jen',
      last_name: 'Simmons',
      entity_type: 'C',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Polar Digital'
      },
      ];
      return {
      entities
      };
      }


      I want to be able to supply a query string which matches different object properties. For example: Just typing in the letter 'J' should return every row in the database I provided above.



      const queryString = `?first_name=${query}&last_name=${query}`;


      This won't work because it will only retrieve results which include both 'J' in both the first_name and last_name.



      Is this possible? Can't seem to find anything on the docs: https://github.com/angular/in-memory-web-api










      share|improve this question
















      I'm creating a prototype live search which uses angular-in-memory-web-api.



      I currently have this:



      createDb() {
      const entities = [{
      id: 11,
      first_name: 'John',
      last_name: 'Doe',
      entity_type: 'P',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'lol'
      },
      {
      id: 12,
      first_name: 'Jen',
      last_name: 'Johnson',
      entity_type: 'C',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'rly'
      },
      {
      id: 13,
      first_name: 'Wendy',
      last_name: 'McGee',
      entity_type: 'A',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Johnny Tightlips ltd.'
      },
      {
      id: 14,
      first_name: 'James',
      last_name: 'Manson',
      entity_type: 'P',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Polar Digital'
      },
      {
      id: 15,
      first_name: 'Jack',
      last_name: 'Black',
      entity_type: 'A',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'HSBC'
      },
      {
      id: 16,
      first_name: 'Jen',
      last_name: 'Simmons',
      entity_type: 'C',
      entity_role: 2,
      ENTITY_STATUS: 'A',
      legal_name: 'Polar Digital'
      },
      ];
      return {
      entities
      };
      }


      I want to be able to supply a query string which matches different object properties. For example: Just typing in the letter 'J' should return every row in the database I provided above.



      const queryString = `?first_name=${query}&last_name=${query}`;


      This won't work because it will only retrieve results which include both 'J' in both the first_name and last_name.



      Is this possible? Can't seem to find anything on the docs: https://github.com/angular/in-memory-web-api







      angular in-memory angular-in-memory-web-api






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 16:28









      SiddAjmera

      15.4k31238




      15.4k31238










      asked Nov 23 '18 at 16:25









      James BarrettJames Barrett

      119212




      119212
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450091%2fis-it-possible-to-use-or-statement-in-angular-in-memory-web-api%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450091%2fis-it-possible-to-use-or-statement-in-angular-in-memory-web-api%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen