Just started to play with Ember.js and by reading the code I encounter the following lines:
Em.TextField.extend({
insertNewline: function() {
....
}
});
as far as I understood, insertNewLine
is an event on clicking "enter" while inside the field, but looking in the documentation for TextField
I failed to find information about this event, and other events of TextField
as well.
What events are supported?
Ember. js uses Handlebars, a lightweight templating engine also maintained by the Ember team. It has the usual templating logic, like if and else , loops and formatting helpers , that kind of stuff. Templates may be precompiled (if you want to cleanly organize them as separate .
Ember. js is an open source, free JavaScript client-side framework used for developing web applications. It allows building client side JavaScript applications by providing a complete solution which contains data management and an application flow.
Not a noob question at all!
Ember TextField inherits from Ember's TextSupport. TextSupport is basically a class that can share functionality for text fields (inputs) and text areas.
If you take a look at TextSupport (https://github.com/emberjs/ember.js/blob/master/packages/ember-handlebars/lib/controls/text_support.js) you'll see a key map at the bottom of the file. This map will be queried on every key up event, trying to match a key to a function. The two default functions are insertNewline (enter) and cancel (esc). You can add as many as you want here.
The keyUp and focusOut methods are also really helpful. I use them a lot for data validation type purposes on edit forms.
https://github.com/emberjs/website/pull/30
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With