Topic: Asynchronous search - mdb autocompleter getting error 'mdb' variable

iqitlab free asked 2 years ago


const asyncAutocomplete = document.querySelector('#async');
const asyncFilter = async (query) => { 
  const url = `https://swapi.py4e.com/api/people/?search=${encodeURI(query)}`; 
  const response = await fetch(url); 
  const data = await response.json();

  return data.results;
};

new mdb.Autocomplete(asyncAutocomplete, { 
  filter: asyncFilter, 
  displayValue: (value) => value.name
});

Grzegorz Bujański staff answered 2 years ago


Please clarify what version of MDB are you using? You specified MDB Angular version 12.0.0, but the code suggests that you are using MDB Standard version.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB4 12.0.0
  • Device: MAC Book Pro
  • Browser: Chrome
  • OS: MAC OS
  • Provided sample code: No
  • Provided link: No