This repository was archived by the owner on Apr 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 254
Add type parameter to google-map-search #296
Open
tst-dhudlow
wants to merge
2
commits into
GoogleWebComponents:master
Choose a base branch
from
tst-dhudlow:SearchSupportType
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]; | ||
|
Contributor
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
Contributor
Author
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
Contributor
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 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.