Keyboard.close() is not working in Ionic2


I’m trying to close a keyboard when user clear the search bar. This is what I’ve done so far

<ion-col style="padding:0px;" col-90 center>
				<ion-searchbar style="padding:0px;" (ionInput)="getItems($event)"  (ionClear)="onClear($event)"></ion-searchbar>


I’ve used ionic-native for keyboard API. As far as i think, it is supposed to close the keyboard as soon as i click cross button on search bar. The problem is it doesn’t do that! Am I missing something?


Do you see the “g” output in the console?


Yes I see it, the function runs fine but Keyboard.close() doesn’t close the keyboard


Can you try this code?



Yes I tried that, I get error while building

[19:05:57]  Error: Error at 
[19:05:57]  Cannot find name 'cordova'. 
[19:05:57]  ngc failed 
[19:05:57]  ionic-app-script task: "build" 
[19:05:57]  Error: Error


declare var cordova; // after import’s