How to close/hide keyborad on enter key in keyboard?

#1

Hello there,
I’m using Ionic3 to build an appliction. In my application, I want to close/hide keyboard when user enter input and click on enter button in keyboard. Actually in the beginning I used like below
import {Keyboard } from ‘ionic-angular’;
and initialized it in constructor and called this.keyboard.close().
But its only remove’s the focus from input field and not able to hide.

Then I found the this plugin https://github.com/ionic-team/cordova-plugin-ionic-keyboard from this one Ionic Keyboard Information Update.

I followed all the steps, but getting the following error:

ERROR TypeError: Keyboard.hide is not a function
at SamplePage.webpackJsonp.100.SamplePage.search (sample.ts:24)
at Object.eval [as handleEvent] (SamplePage.html:20)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at platform-browser.js:2628
at platform-browser.js:3687
at t.invoke (polyfills.js:3)

Can u please help to get out of this. Or is any other way to do it?
Thanks in advance.