Topic: CompleterService customization for remote data

Anne-Nora Chavanes pro asked 5 years ago


I am cloning the AutocompleteComponent from ng-uikit-pro-standard-7.4.0\projects\mdb-demo\src\app\components\forms\autocomplete\ directory into my app.

After every keystroke, I'd like to append a '*' to the URL, indicating to my HTTP service, that this is a LIKE operation, not a WHERE, e.g. http://localhost/api/Person/Smith*

What would be the best way to do this, please?

Is there a way to specify a URL suffix that always gets appended to the service URL?


Arkadiusz Idzikowski staff answered 5 years ago


You can try something like this:

  public dataRemote: RemoteData;

  constructor(private completerService: CompleterService) {

    this.dataRemote = completerService.remote('apiUrl', 'name', 'name');
    this.dataRemote.urlFormater(input => {
      return `myUrl/${input}*`;
    });

  }


Awesome. Worked great. Thx.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.0.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes