Class Ember.TextArea
publicThe internal class used to create textarea element when the {{textarea}}
helper is used.
See Ember.Templates.helpers.textarea for usage details.
Layout and LayoutName properties
Because HTML textarea
elements do not contain inner HTML the layout
and
layoutName
properties will not be applied. See Ember.View's
layout section for more information.
actions public
Inherited from Ember.ActionHandler packages/ember-runtime/lib/mixins/action_handler.js:24
The collection of functions, keyed by name, available on this
ActionHandler
as action targets.
These functions will be invoked when a matching {{action}}
is triggered
from within a template and the application's current route is this route.
Actions can also be invoked from other parts of your application
via ActionHandler#send
.
The actions
hash will inherit action handlers from
the actions
hash defined on extended parent classes
or mixins rather than just replace the entire hash, e.g.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
App.CanDisplayBanner = Ember.Mixin.create({ actions: { displayBanner: function(msg) { // ... } } }); App.WelcomeRoute = Ember.Route.extend(App.CanDisplayBanner, { actions: { playMusic: function() { // ... } } }); // `WelcomeRoute`, when active, will be able to respond // to both actions, since the actions hash is merged rather // then replaced when extending mixins / parent classes. this.send('displayBanner'); this.send('playMusic'); |
Within a Controller, Route, View or Component's action handler,
the value of the this
context is the Controller, Route, View or
Component object:
1 2 3 4 5 6 7 8 9 |
App.SongRoute = Ember.Route.extend({ actions: { myAction: function() { this.controllerFor("song"); this.transitionTo("other.route"); ... } } }); |
It is also possible to call this._super(...arguments)
from within an
action handler if it overrides a handler defined on a parent
class or mixin:
Take for example the following routes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
App.DebugRoute = Ember.Mixin.create({ actions: { debugRouteInformation: function() { console.debug("trololo"); } } }); App.AnnoyingDebugRoute = Ember.Route.extend(App.DebugRoute, { actions: { debugRouteInformation: function() { // also call the debugRouteInformation of mixed in App.DebugRoute this._super(...arguments); // show additional annoyance window.alert(...); } } }); |
Bubbling
By default, an action will stop bubbling once a handler defined
on the actions
hash handles it. To continue bubbling the action,
you must return true
from the handler:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
App.Router.map(function() { this.route("album", function() { this.route("song"); }); }); App.AlbumRoute = Ember.Route.extend({ actions: { startPlaying: function() { } } }); App.AlbumSongRoute = Ember.Route.extend({ actions: { startPlaying: function() { // ... if (actionShouldAlsoBeTriggeredOnParentRoute) { return true; } } } }); |
ariaRole public
Inherited from Ember.AriaRoleSupport packages/ember-views/lib/mixins/aria_role_support.js:16
The WAI-ARIA role of the control represented by this view. For example, a button may have a role of type 'button', or a pane may have a role of type 'alertdialog'. This property is used by assistive software to help visually challenged users navigate rich web applications.
The full list of valid WAI-ARIA roles is available at: http://www.w3.org/TR/wai-aria/roles#roles_categorization
classNameBindings public
Inherited from Ember.ClassNamesSupport packages/ember-views/lib/mixins/class_names_support.js:41
A list of properties of the view to apply as class names. If the property is a string value, the value of that string will be applied as a class name.
1 2 3 4 5 |
// Applies the 'high' class to the view element Ember.View.extend({ classNameBindings: ['priority'], priority: 'high' }); |
If the value of the property is a Boolean, the name of that property is added as a dasherized class name.
1 2 3 4 5 |
// Applies the 'is-urgent' class to the view element Ember.View.extend({ classNameBindings: ['isUrgent'], isUrgent: true }); |
If you would prefer to use a custom value instead of the dasherized property name, you can pass a binding like this:
1 2 3 4 5 |
// Applies the 'urgent' class to the view element Ember.View.extend({ classNameBindings: ['isUrgent:urgent'], isUrgent: true }); |
This list of properties is inherited from the view's superclasses as well.
classNames public
Inherited from Ember.ClassNamesSupport packages/ember-views/lib/mixins/class_names_support.js:29
Standard CSS class names to apply to the view's outer element. This property automatically inherits any class names defined by the view's superclasses as well.
concatenatedProperties public
Inherited from Ember.CoreObject packages/ember-runtime/lib/system/core_object.js:272
Defines the properties that will be concatenated from the superclass (instead of overridden).
By default, when you extend an Ember class a property defined in
the subclass overrides a property with the same name that is defined
in the superclass. However, there are some cases where it is preferable
to build up a property's value by combining the superclass' property
value with the subclass' value. An example of this in use within Ember
is the classNames
property of Ember.View
.
Here is some sample code showing the difference between a concatenated property and a normal one:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
App.BarView = Ember.View.extend({ someNonConcatenatedProperty: ['bar'], classNames: ['bar'] }); App.FooBarView = App.BarView.extend({ someNonConcatenatedProperty: ['foo'], classNames: ['foo'] }); var fooBarView = App.FooBarView.create(); fooBarView.get('someNonConcatenatedProperty'); // ['foo'] fooBarView.get('classNames'); // ['ember-view', 'bar', 'foo'] |
This behavior extends to object creation as well. Continuing the above example:
1 2 3 4 5 6 |
var view = App.FooBarView.create({ someNonConcatenatedProperty: ['baz'], classNames: ['baz'] }) view.get('someNonConcatenatedProperty'); // ['baz'] view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz'] |
Adding a single property that is not an array will just add it in the array:
1 2 3 4 |
var view = App.FooBarView.create({ classNames: 'baz' }) view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz'] |
Using the concatenatedProperties
property, we can tell Ember to mix the
content of the properties.
In Ember.View
the classNameBindings
and attributeBindings
properties
are also concatenated, in addition to classNames
.
This feature is available for you to use throughout the Ember object model, although typical app developers are likely to use it infrequently. Since it changes expectations about behavior of properties, you should properly document its usage in each individual concatenated property (to not mislead your users to think they can override the property in a subclass).
element public
Inherited from Ember.ViewTargetActionSupport packages/ember-views/lib/mixins/view_support.js:196
Returns the current DOM element for the view.
elementId public
Inherited from Ember.ViewTargetActionSupport packages/ember-views/lib/mixins/view_support.js:409
The HTML id
of the view's element in the DOM. You can provide this
value yourself but it must be unique (just as in HTML):
If not manually set a default value will be provided by the framework.
Once rendered an element's elementId
is considered immutable and you
should never change it. If you need to compute a dynamic value for the
elementId
, you should do this when the component or element is being
instantiated:
1 2 3 4 5 6 |
export default Ember.Component.extend({ setElementId: Ember.on('init', function() { var index = this.get('index'); this.set('elementId', 'component-id' + index); }) }); |
hasBlock public
Inherited from Ember.Component packages/ember-views/lib/components/component.js:329
Available since v1.13.0
- returns
- Boolean
Returns true when the component was invoked with a block template.
Example (hasBlock
will be false
):
Example (hasBlock
will be true
):
This helper accepts an argument with the name of the block we want to check the presence of. This is useful for checking for the presence of the optional inverse block in components.
hasBlockParams public
Inherited from Ember.Component packages/ember-views/lib/components/component.js:389
Available since v1.13.0
- returns
- Boolean
Returns true when the component was invoked with a block parameter supplied.
Example (hasBlockParams
will be false
):
Example (hasBlockParams
will be true
):
instrumentDisplay public
Inherited from Ember.InstrumentationSupport packages/ember-views/lib/mixins/instrumentation_support.js:15
Used to identify this view during debugging
isDestroyed public
Inherited from Ember.CoreObject packages/ember-runtime/lib/system/core_object.js:410
Destroyed object property flag.
if this property is true
the observers and bindings were already
removed by the effect of calling the destroy()
method.
isDestroying public
Inherited from Ember.CoreObject packages/ember-runtime/lib/system/core_object.js:422
Destruction scheduled flag. The destroy()
method has been called.
The object stays intact until the end of the run loop at which point
the isDestroyed
flag is set.
isVisible public
Inherited from Ember.VisibilitySupport packages/ember-views/lib/mixins/visibility_support.js:20
If false
, the view will appear hidden in DOM.
mergedProperties public
Inherited from Ember.CoreObject packages/ember-runtime/lib/system/core_object.js:341
Defines the properties that will be merged from the superclass (instead of overridden).
By default, when you extend an Ember class a property defined in
the subclass overrides a property with the same name that is defined
in the superclass. However, there are some cases where it is preferable
to build up a property's value by merging the superclass property value
with the subclass property's value. An example of this in use within Ember
is the queryParams
property of routes.
Here is some sample code showing the difference between a merged property and a normal one:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
App.BarRoute = Ember.Route.extend({ someNonMergedProperty: { nonMerged: 'superclass value of nonMerged' }, queryParams: { page: {replace: false}, limit: {replace: true} } }); App.FooBarRoute = App.BarRoute.extend({ someNonMergedProperty: { completelyNonMerged: 'subclass value of nonMerged' }, queryParams: { limit: {replace: false} } }); var fooBarRoute = App.FooBarRoute.create(); fooBarRoute.get('someNonMergedProperty'); // => { completelyNonMerged: 'subclass value of nonMerged' } // // Note the entire object, including the nonMerged property of // the superclass object, has been replaced fooBarRoute.get('queryParams'); // => { // page: {replace: false}, // limit: {replace: false} // } // // Note the page remains from the superclass, and the // `limit` property's value of `false` has been merged from // the subclass. |
This behavior is not available during object create
calls. It is only
available at extend
time.
This feature is available for you to use throughout the Ember object model, although typical app developers are likely to use it infrequently. Since it changes expectations about behavior of properties, you should properly document its usage in each individual merged property (to not mislead your users to think they can override the property in a subclass).
positionalParams public
Inherited from Ember.Component packages/ember-views/lib/components/component.js:430
Available since v1.13.0
Enables components to take a list of parameters as arguments
For example a component that takes two parameters with the names
name
and age
:
1 2 3 4 |
let MyComponent = Ember.Component.extend; MyComponent.reopenClass({ positionalParams: ['name', 'age'] }); |
It can then be invoked like this:
The parameters can be refered to just like named parameters:
Using a string instead of an array allows for an arbitrary number of parameters:
1 2 3 4 |
let MyComponent = Ember.Component.extend; MyComponent.reopenClass({ positionalParams: 'names' }); |
It can then be invoked like this:
The parameters can then be refered to by enumerating over the list:
tagName public
Inherited from Ember.ViewTargetActionSupport packages/ember-views/lib/mixins/view_support.js:555
Tag name for the view's outer element. The tag name is only used when an
element is first created. If you change the tagName
for an element, you
must destroy and recreate the view element.
By default, the render buffer will use a <div>
tag for views.