spotify-search polymer element
This is an example of a Polymer Web Component that implements a Search component for searching tracks, albums and artists on Spotify. It is useful in combination with other components such as the Spotify Preview Button.
You just need to include the polymer platform and this element in the head of your html page.
Then, you can start using the
spotify-search element as any other HTML element
in your page.
Input parameters, through attributes:
query(required): The search query's keywords
type(optional, default: 'tracks'): The type of entity you want to fetch.
limit(optional): The maximum number of objects to return. Check the default value on the Spotify Web API documentation page.
offset(optional, defaults to 0): The index of the first object to return.
The search results are available in an exposed
result property, and also through the triggered event
Running the example
To launch the example, install the
spotify-search bower component:
$ bower install spotify-search
Then launch a web server:
$ ruby -run -e httpd . -p 5000 # "python -m SimpleHTTPServer 5000" will also do the trick
Then, you only need to navigate to http://localhost:5000/demo/ from any modern browser.