input search and voice commands
import:
<link rel="import" href="/bower_components/paper-search-input/paper-search-input.html">
html
<paper-search-input id="paper-search-input" languaje="es-CO"></paper-search-input>
var paperInputSearch = document.getElementById('paper-search-input');
paperInputSearch._commandsVoice(
{
'hola': function() { alert('Hello world!'); annyang.abort(); },
'busca a *val':function(val) {
alert('Buscando a:'+ val);
paperInputSearch.hearVoiceStop();
},
'cuanto es :val + :val2':function(val, val2) {
var v1 = parseInt(val);
var v2 = parseInt(val2);
paperInputSearch.value = 'cuanto es '+v1+' + '+v2;
alert('el resultado es:'+ (v1 + v2) );
paperInputSearch.hearVoiceStop();
}
}
);
Use search history option
<paper-search-input id="paper-search-input" languaje="es-CO" search-history></paper-search-input>
add items searchHistory
var paperInputSearch = document.getElementById('paper-search-input');
paperInputSearch.searchItems = [
{
"title":'Historial',
"subtitle":'',
"value":'',
"icon":'history'
},
{
"title":'Clientes enero',
"subtitle":'ene, 19 2016',
"value":'2015-01-19',
"icon":'chevron-right'
}
];
MIT
Free Component, Yeah!