Unsubscribe ionic keyboard onKeyboardShow()

#1

Hi, I subscribe the this.keyboard.onKeyboardShow() on my page but on ngOnDestroy() i want to unsubscribe it. Can any know the how to unsubscribe with onKeyboardShow().

#2

Its similar to the way platform.resume subscribes and unsubscribes, you need a reference.

//subscribes
let keyboardShowRef = this.keyboard.onKeyboardShow().subscribe(kb=>{
//your code
})
//unsubscribes
keyboardShowRef.unsubscribe();
1 Like