Collaborne / paper-search

A Material Design search bar (Polymer)
https://www.webcomponents.org/element/Collaborne/paper-search
Apache License 2.0
51 stars 29 forks source link

get the query of user from paper-search-bar #14

Closed rafaelleru closed 7 years ago

rafaelleru commented 7 years ago

I'm using paper search bar but I can't obtain the query that user wants to search by:

paper-searc-element.query

and in API I dont understand how to get this.

ronnyroeller commented 7 years ago

@rafaelleru - Not sure if I fully understand your question... But have a look to the demo: https://github.com/Collaborne/paper-search/blob/master/demo/paper-search-panel.html#L22

rafaelleru commented 7 years ago

Yes I look the demo and in my code works fine, but when I try to change

   scope.search = function() {
    alert("searching...");
    };

for:

scope.search = function() {
    alert(scope.query);;
};

I get empty alert, and I can't find a way to get the user input from scope

ronnyroeller commented 7 years ago

I extended the demo to show how to access the query property: https://github.com/Collaborne/paper-search/commit/c422be4b16d9ebd1232d14b03c11ea53880c3fe0

In case you use <paper-search-panel> (instead of just <paper-search-bar>): Please be aware that the property is called search (not query) -> https://github.com/Collaborne/paper-search/blob/master/demo/paper-search-panel.html#L22