简体   繁体   中英

How do I handle a keyboard press event in ionic/cordova

I have an ionic application I am developing, and I need a way to handle the return key. When I press the key on the keyboard, the application reloads, like, from the beginning (login). So no matter where I am, and I am using the keyboard, pressing enter has that effect. The problem is irregardless of the platform or device type. How do I best resolve this?

For return key it is same as javascript

if(characterCode == 13)
   {
     return false; // returning false will prevent the event from bubbling          up.
   }
   else
   {
      return true;
    }

On htl tag of input aff and call this scope function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM