-
Notifications
You must be signed in to change notification settings - Fork 255
Add type parameter to google-map-search #296
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,16 @@ <h2>{{marker.name}}</h2> | |
}, | ||
|
||
/** | ||
* @deprecated | ||
* | ||
* Warning: The implementation for types in text search requests is changing. The types parameter is deprecated | ||
* as of February 16, 2016, replaced by a new type parameter which only supports one type per search request. | ||
* Additionally, the establishment, place_of_worship, food, health, general_contractor and finance types will | ||
* no longer be supported as search parameters (however these types may still be returned in the results of a | ||
* search). Requests using the deprecated features will be supported until February 16, 2017, after which all | ||
* text searches must use the new implementation. | ||
* See https://developers.google.com/maps/documentation/javascript/places | ||
* | ||
* Space-separated list of result types. | ||
* The search will only return results of the listed types. | ||
* See https://developers.google.com/places/documentation/supported_types | ||
|
@@ -105,6 +115,18 @@ <h2>{{marker.name}}</h2> | |
value: null | ||
}, | ||
|
||
/** | ||
* Search result type | ||
* The search will only return results of the listed type. | ||
* See https://developers.google.com/places/documentation/supported_types | ||
* for a list of supported types. | ||
* Leave empty or null to search for all result types. | ||
*/ | ||
type: { | ||
type: String, | ||
value: null | ||
}, | ||
|
||
/** | ||
* The search results. | ||
*/ | ||
|
@@ -147,13 +169,18 @@ <h2>{{marker.name}}</h2> | |
* Perform a search using for `query` for the search term. | ||
*/ | ||
search: function() { | ||
if (this.query && this.map) { | ||
if (this.map && (this.query || this.type)) { | ||
var places = new google.maps.places.PlacesService(this.map); | ||
|
||
if (this.types && typeof this.types == 'string') { | ||
var types = this.types.split(' '); | ||
} | ||
|
||
if (this.type && typeof this.type == 'string') { | ||
var typeArray = this.type.split(' '); | ||
var type = typeArray[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you need to init There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm missing something, but is there a reason why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right that the precedence has already been set :) I guess |
||
} | ||
|
||
if (!this.globalSearch) { | ||
var bounds = this.map.getBounds(); | ||
} else if (this.radius) { | ||
|
@@ -164,6 +191,7 @@ <h2>{{marker.name}}</h2> | |
places.textSearch({ | ||
query: this.query, | ||
types: types, | ||
type: type, | ||
bounds: bounds, | ||
radius: radius, | ||
location: location | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes it look like the entire file is deprecated, when it's just the type stuff.