1

I'm trying to figure out how to pass event parameters from a component back to my class handling the event.

In my case, I'm trying to register a "KeyPressed" event in a component, like so:

<textarea ng-keypress="cmp.KeyPressed(event)" rows="1" cols="100"></textarea>

And the code handling the event looks like this:

void KeyPressed(event) {
   print("keypressed!");
}

Whenever a key is pressed, the KeyPressed() function fires. However, the "event" being passed in is null. How do I pass in event parameters correctly, and what is the event type?

1 Answer 1

2

You need to use $event

<textarea ng-keypress="cmp.KeyPressed($event)" rows="1" cols="100"></textarea>
Sign up to request clarification or add additional context in comments.

1 Comment

Great! It's working and returns an instance of a 'KeyboardEvent' class. Is this info referenced in any documentation? I've looked all over and couldn't find anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.