Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:17:02+00:00 2026-06-06T15:17:02+00:00

How can I detect onKeyUp in AngularJS? I’m looking for an ‘ngOnkeyup’ directive, similar

  • 0

How can I detect onKeyUp in AngularJS?

I’m looking for an ‘ngOnkeyup’ directive, similar to ngChange, but I can’t find anything suitable.

If there isn’t such a directive, is there a clean way to call into the controller from a browser-native onkeyup event?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:17:04+00:00Added an answer on June 6, 2026 at 3:17 pm

    EDIT: see second answer below from maklemenz which refers to the new built-in ng-keyup directive

    You could use the angular-ui library:

    With angular-ui, you can just do

    <input ui-event="{keyup: 'myFn($event)'}"
    

    If you don’t want to use another library, the most efficient and simple way to do this is:

    JS

    myApp.directive('onKeyup', function() {
      return function(scope, elm, attrs) {
        elm.bind("keyup", function() {
          scope.$apply(attrs.onKeyup);
        });
      };
    });
    

    HTML:

    <input on-keyup="count = count + 1">
    

    Edit: If you wanted to detect which key was pressed, you have two basic options really. You could add an attribute to the directive to handle the allowed keys within the directive, or you could pass the key pressed to your controller. I would generally recommend the directive handles the key method.

    Here’s an example of both ways: http://jsfiddle.net/bYUa3/2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can detect that app is running under iOS Simulator (using sysctlbyname(hw.machine) ), but
I know that richtextboxes can detect links (like http://www.yahoo.com ) but is there a
Is there a way I can detect an image URL, like: http://mysite.com/image.jpg but with
I can detect single/double-taps in specific views with: NSSet *myTouches = [event touchesForView:mySpecificView.view]; but
I'd like to find a tool that can detect redundant/unused tables and stored procedures
I'm looking for .NET static code analysis tools that can detect things like unit
I can detect when a variable changes , but it changes so often that
the Windows API SHChangeNotifyRegister can detect file creation in disk, but how to know
How I can detect element I click in UIWebView. I have simple html, but
Are there known algorithms that can detect image degradation programatically without looking at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.