Skip to content

Make "No results found" configurable via configs #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function getFooterNode() {
* @param {String} [options.worldview="us"] Filter results to geographic features whose characteristics are defined differently by audiences belonging to various regional, cultural, or political groups.
* @param {Boolean} [options.enableGeolocation=false] If `true` enable user geolocation feature.
* @param {('address'|'street'|'place'|'country')} [options.addressAccuracy="street"] The accuracy for the geolocation feature with which we define the address line to fill. The browser API returns the user's position with accuracy, and sometimes we can get the neighbor's address. To prevent receiving an incorrect address, you can reduce the accuracy of the definition.
* @param {String} [options.noResultsLabel="No results found"] Text to display if no results have been found.
* @example
* var geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken });
* map.addControl(geocoder);
Expand Down Expand Up @@ -888,7 +889,7 @@ MapboxGeocoder.prototype = {
},

_renderNoResults: function(){
var errorMessage = "<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>";
var errorMessage = `<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>${this.options.noResultsLabel || 'No results found'}</div>`;
this._renderMessage(errorMessage);
},

Expand Down