O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing events in components

Just like views, components can catch user-generated events such as those from the keyboard, mouse, and touch devices.

There are two ways in which the handlers to these events can be defined, the first of which is to attach the .on function to the event-subscriber method. For example, the post-input component uses this function to define two handlers. This button component implements a file-picker dialog that can be opened from an invisible file input, as described at https://github.com/component/file-picker. As soon as the component gets rendered, the event is fired, which results in the hidden form element containing a single input file to be appended into DOM as:

createHiddenForm: function(){ var tmpl = [ '<form ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required