Ember._HandlebarsBoundView Class
Ember._HandlebarsBoundView
is a private view created by the Handlebars
{{bind}}
helpers that is used to keep track of bound properties.
Every time a property is bound using a {{mustache}}
, an anonymous subclass
of Ember._HandlebarsBoundView
is created with the appropriate sub-template
and context set up. When the associated property changes, just the template
for this view will re-render.
Item Index
Methods
- $
- _applyAttributeBindings
- _applyClassNameBindings
- _classStringForProperty
- _contextDidChange
- _elementDidChange
- _insertElementLater
- _isVisibleDidChange
- _notifyWillDestroyElement
- _parentViewDidChange
- _scheduledDestroy
- addObserver
- append
- appendTo
- beginPropertyChanges
- cacheFor
- createChildView
- createElement
- decrementProperty
- destroy
- destroyElement
- eachComputedProperty
- endPropertyChanges
- findElementInParentElement
- get
- getProperties
- getWithDefault
- handleEvent
- has
- hasObserverFor
- incrementProperty
- init
- invokeRecursively
- metaForProperty
- nearestChildOf
- nearestInstanceOf deprecated
- nearestOfType
- nearestWithProperty
- notifyPropertyChange
- off
- on
- one
- propertyDidChange
- propertyWillChange
- remove
- removeAllChildren
- removeChild
- removeFromParent
- removeObserver
- render
- renderToBuffer
- reopen
- reopenClass
- replaceIn
- rerender
- send
- set
- setProperties
- setUnknownProperty
- toggleProperty
- toString
- trigger
- willDestroy
- willMergeMixin
Properties
- _context
- actions
- ariaRole
- attributeBindings
- childViews
- classNameBindings
- classNames
- concatenatedProperties
- context
- controller
- displayTemplate
- element
- instrumentDisplay
- inverseTemplate
- isDestroyed
- isDestroying
- isVisible
- layout
- layoutName
- parentView
- path
- pathRoot
- preserveContext
- previousContext
- shouldDisplayFunc
- tagName
- template
- templateName
Methods
$
-
[selector]
view.$('li')
will return a jQuery object containing
all of the li
elements inside the DOM element of this view.
Parameters:
-
[selector]
String optionala jQuery-compatible selector string
Returns:
_applyAttributeBindings
-
buffer
Parameters:
-
buffer
Ember.RenderBuffer
_applyClassNameBindings
()
private
classNameBindings
array, inserts the value
of the specified property into the classNames
array, then creates an
observer to update the view's element if the bound property ever changes
in the future.
_classStringForProperty
-
property
isUrgent
that evaluates to true,
passing isUrgent
to this method will return "is-urgent"
.
Parameters:
-
property
Object
_contextDidChange
()
private
_elementDidChange
()
private
_insertElementLater
-
fn
willInsertElement
event. After your function is invoked, this view
and all of its child views will receive the didInsertElement
event.
`
javascript
view._insertElementLater(function() {
this.createElement();
this.$().appendTo('body');
});
`
Parameters:
-
fn
Functionthe function that inserts the element into the DOM
_isVisibleDidChange
()
private
isVisible
property changes, toggle the visibility
element of the actual DOM element.
_notifyWillDestroyElement
()
private
willDestroyElement
event (which invokes the
willDestroyElement()
method if it exists) on this view and all child
views.
Before triggering willDestroyElement
, it first triggers the
willClearRender
event recursively.
_parentViewDidChange
()
private
controller
_scheduledDestroy
()
private
destroy
method.
addObserver
-
key
-
target
-
method
context
parameter:
`
javascript
fooDidChange: function(sender, key, value, rev) { };
`
The sender is the object that changed. The key is the property that
changes. The value property is currently reserved and unused. The rev
is the last property revision of the object when it changed, which you can
use to detect if the key value has really changed or not.
If you pass a context
parameter, the context will be passed before the
revision like so:
`
javascript
fooDidChange: function(sender, key, value, context, rev) { };
`
Usually you will not need the value, context or revision parameters at
the end. In this case, it is common to write observer methods that take
only a sender and key value as parameters or, if you aren't interested in
any of these values, to write an observer that has no parameters at all.
append
()
Ember.View
createElement()
will be called
automatically.
If your application uses the rootElement
property, you must append
the view within that element. Rendering views outside of the rootElement
is not supported.
Note that this method just schedules the view to be appended; the DOM
element will not be appended to the document body until all bindings have
finished synchronizing.
Returns:
appendTo
-
A
createElement()
will be called automatically.
Note that this method just schedules the view to be appended; the DOM
element will not be appended to the given element until all bindings have
finished synchronizing.
This is not typically a function that you will need to call directly when
building your application. You might consider using Ember.ContainerView
instead. If you do need to use appendTo
, be sure that the target element
you are providing is associated with an Ember.Application
and does not
have an ancestor element that is associated with an Ember view.
Parameters:
-
A
String | DOMElement | JQueryselector, element, HTML string, or jQuery object
Returns:
beginPropertyChanges
()
Ember.Observable
endPropertyChanges()
to deliver the deferred change notifications and end
deferring.
Returns:
cacheFor
-
keyName
Parameters:
-
keyName
String
Returns:
createChildView
-
viewClass
-
[attrs]
createChildViews()
. Note that this method will
automatically configure the correct settings on the new view instance to
act as a child of the parent.
Parameters:
-
viewClass
Class | String -
[attrs]
Hash optionalAttributes to add
Returns:
createElement
()
Ember.View
render()
method.
After the element has been created, didInsertElement
will
be called on this view and all of its child views.
Returns:
decrementProperty
-
keyName
-
decrement
`
javascript
player.decrementProperty('lives');
orc.decrementProperty('health', 5);
`
Parameters:
-
keyName
StringThe name of the property to decrement -
decrement
NumberThe amount to decrement by. Defaults to 1
Returns:
destroy
()
destroy
on a view to destroy the view (and all of its
child views). This will remove the view from any parent node, then make
sure that the DOM element managed by the view can be released by the
memory manager.
destroyElement
()
Ember.View
willDestroyElement()
on your view, then this method will
be invoked on your view before your element is destroyed to give you a
chance to clean up any event handlers, etc.
If you write a willDestroyElement()
handler, you can assume that your
didInsertElement()
handler was called earlier for the same element.
You should not call or override this method yourself, but you may
want to implement the above callbacks.
Returns:
eachComputedProperty
-
callback
-
binding
metaForProperty
) to the callback.
Parameters:
-
callback
Function -
binding
Object
endPropertyChanges
()
Ember.Observable
beginPropertyChanges()
at the beginning of the changes to defer change
notifications. When you are done making changes, call this method to
deliver the deferred change notifications and end deferring.
Returns:
findElementInParentElement
-
parentElement
elementId
(or the
view's guid if elementId
is null). You can override this method to
provide your own form of lookup. For example, if you want to discover your
element using a CSS class name instead of an ID.
Parameters:
-
parentElement
DOMElementThe parent's DOM element
Returns:
get
-
keyName
object[keyName]
or object.keyName
,
however it supports both computed properties and the unknownProperty
handler.
Because get
unifies the syntax for accessing all these kinds
of properties, it can make many refactorings easier, such as replacing a
simple property with a computed property, or vice versa.
### Computed Properties
Computed properties are methods defined with the property
modifier
declared at the end, such as:
`
javascript
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')
`
When you call get
on a computed property, the function will be
called and the return value will be returned instead of the function
itself.
### Unknown Properties
Likewise, if you try to call get
on a property whose value is
undefined
, the unknownProperty()
method will be called on the object.
If this method returns any value other than undefined
, it will be returned
instead. This allows you to implement "virtual" properties that are
not defined upfront.
Parameters:
-
keyName
StringThe property to retrieve
Returns:
getProperties
-
list
getProperties
with a list of strings or an array:
`
javascript
record.getProperties('firstName', 'lastName', 'zipCode'); // { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
`
is equivalent to:
`
javascript
record.getProperties(['firstName', 'lastName', 'zipCode']); // { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
`
Parameters:
-
list
String... | Arrayof keys to get
Returns:
getWithDefault
-
keyName
-
defaultValue
undefined
.
`
javascript
person.getWithDefault('lastName', 'Doe');
`
Parameters:
-
keyName
StringThe name of the property to retrieve -
defaultValue
ObjectThe value to return if the property value is undefined
Returns:
handleEvent
-
eventName
-
evt
Ember.EventDispatcher
Parameters:
-
eventName
String -
evt
Event
has
-
name
Parameters:
-
name
StringThe name of the event
Returns:
hasObserverFor
-
key
true
if the object currently has observers registered for a
particular key. You can use this method to potentially defer performing
an expensive action until someone begins observing a particular property
on the object.
Parameters:
-
key
StringKey to check
Returns:
incrementProperty
-
keyName
-
increment
`
javascript
person.incrementProperty('age');
team.incrementProperty('score', 2);
`
Parameters:
-
keyName
StringThe name of the property to increment -
increment
NumberThe amount to increment by. Defaults to 1
Returns:
init
()
private
childViews
* register the view with the global views hash, which is used for event
dispatch
invokeRecursively
-
fn
-
includeSelf
Parameters:
-
fn
Function -
includeSelf
BooleanIncludes itself if true.
metaForProperty
-
key
`
javascript
person: function() {
var personId = this.get('personId');
return App.Person.create({ id: personId });
}.property().meta({ type: App.Person })
`
Once you've done this, you can retrieve the values saved to the computed
property from your class like this:
`
javascript
MyClass.metaForProperty('person');
`
This will return the original hash that was passed to meta()
.
Parameters:
-
key
Stringproperty name
nearestChildOf
-
klass
klass
.
Parameters:
-
klass
ClassSubclass of Ember.View (or Ember.View itself)
Returns:
nearestInstanceOf
-
klass
Parameters:
-
klass
ClassSubclass of Ember.View (or Ember.View itself)
Returns:
nearestOfType
-
klass
Parameters:
-
klass
Class,MixinSubclass of Ember.View (or Ember.View itself), or an instance of Ember.Mixin.
Returns:
nearestWithProperty
-
property
Parameters:
-
property
StringA property name
Returns:
notifyPropertyChange
-
keyName
propertyWillChange
and propertyDidChange
in
succession.
Parameters:
-
keyName
StringThe property key to be notified about.
Returns:
off
-
name
-
target
-
method
Parameters:
Returns:
on
-
name
-
[target]
-
method
`
javascript
person.on('didLoad', function() {
// fired once the person has loaded
});
`
An optional target can be passed in as the 2nd argument that will
be set as the "this" for the callback. This is a good way to give your
function access to the object triggering the event. When the target
parameter is used the callback becomes the third argument.
Parameters:
Returns:
one
-
name
-
[target]
-
method
`one
` when
you only care about the first time an event has taken place.
This function takes an optional 2nd argument that will become the "this"
value for the callback. If this argument is passed then the 3rd argument
becomes the function.
Parameters:
Returns:
propertyDidChange
-
keyName
get()
or set()
on it. In this case, you can use this
method and propertyWillChange()
instead. Calling these two methods
together will notify all observers that the property has potentially
changed value.
Note that you must always call propertyWillChange
and propertyDidChange
as a pair. If you do not, it may get the property change groups out of
order and cause notifications to be delivered more often than you would
like.
Parameters:
-
keyName
StringThe property key that has just changed.
Returns:
propertyWillChange
-
keyName
get()
or set()
on it. In this case, you can use this
method and propertyDidChange()
instead. Calling these two methods
together will notify all observers that the property has potentially
changed value.
Note that you must always call propertyWillChange
and propertyDidChange
as a pair. If you do not, it may get the property change groups out of
order and cause notifications to be delivered more often than you would
like.
Parameters:
-
keyName
StringThe property key that is about to change.
Returns:
remove
()
Ember.View
Returns:
removeAllChildren
()
Ember.View
parentView
.
Returns:
removeChild
-
view
Parameters:
-
view
Ember.View
Returns:
removeFromParent
()
Ember.View
parentView
, if one is found. Otherwise
does nothing.
Returns:
removeObserver
-
key
-
target
-
method
addObserver()
and your
target will no longer receive notifications.
render
-
buffer
Determines which template to invoke, sets up the correct state based on
that logic, then invokes the default Ember.View
render
implementation.
This method will first look up the path
key on pathRoot
,
then pass that value to the shouldDisplayFunc
function. If that returns
true,
the displayTemplate
function will be rendered to DOM. Otherwise,
inverseTemplate
, if specified, will be rendered.
For example, if this Ember._HandlebarsBoundView
represented the {{#with foo}}
helper, it would look up the foo
property of its context, and
shouldDisplayFunc
would always return true. The object found by looking
up foo
would be passed to displayTemplate
.
Parameters:
-
buffer
Ember.RenderBuffer
renderToBuffer
-
buffer
render()
method is invoked, which is responsible for
doing the bulk of the rendering.
You should not need to override this method; instead, implement the
template
property, or if you need more control, override the render
method.
Parameters:
-
buffer
Ember.RenderBufferthe render buffer. If no buffer is passed, a default buffer, using the current view'stagName
, will be used.
reopen
()
`
javascript
MyObject = Ember.Object.extend({
name: 'an object'
});
o = MyObject.create();
o.get('name'); // 'an object'
MyObject.reopen({
say: function(msg){
console.log(msg);
}
})
o2 = MyObject.create();
o2.say("hello"); // logs "hello"
o.say("goodbye"); // logs "goodbye"
`
To add functions and properties to the constructor itself,
see reopenClass
reopenClass
()
`
javascript
MyObject = Ember.Object.extend({
name: 'an object'
});
MyObject.reopenClass({
canBuild: false
});
MyObject.canBuild; // false
o = MyObject.create();
`
In other words, this creates static properties and functions for the class. These are only available on the class
and not on any instance of that class.
`
javascript
App.Person = Ember.Object.extend({
name : "",
sayHello : function(){
alert("Hello. My name is " + this.get('name'));
}
});
App.Person.reopenClass({
species : "Homo sapiens",
createPerson: function(newPersonsName){
return App.Person.create({
name:newPersonsName
});
}
});
var tom = App.Person.create({
name : "Tom Dale"
});
var yehuda = App.Person.createPerson("Yehuda Katz");
tom.sayHello(); // "Hello. My name is Tom Dale"
yehuda.sayHello(); // "Hello. My name is Yehuda Katz"
alert(App.Person.species); // "Homo sapiens"
`
Note that species
and createPerson
are *not* valid on the tom
and yehuda
variables. They are only valid on App.Person
.
To add functions and properties to instances of
a constructor by extending the constructor's prototype
see reopen
replaceIn
-
target
createElement()
will be called automatically.
Note that this method just schedules the view to be appended; the DOM
element will not be appended to the given element until all bindings have
finished synchronizing
Parameters:
-
target
String | DOMElement | JQueryA selector, element, HTML string, or jQuery object
Returns:
rerender
()
appendChild
,
rerender
will remove them, because they will be added again
if needed by the next render
.
In general, if the display of your view changes, you should modify
the DOM element directly instead of manually calling rerender
, which can
be slow.
send
-
actionName
-
context
ActionHandler
. Any parameters
supplied after the actionName
string will be passed as arguments
to the action target function.
If the ActionHandler
has its target
property set, actions may
bubble to the target
. Bubbling happens when an actionName
can
not be found in the ActionHandler
's actions
hash or if the
action target function returns true
.
Example
`
js
App.WelcomeRoute = Ember.Route.extend({
actions: {
playTheme: function() {
this.send('playMusic', 'theme.mp3');
},
playMusic: function(track) {
// ...
}
}
});
`
Parameters:
-
actionName
StringThe action to trigger -
context
a context to send with the action
set
-
keyName
-
value
object[key] = value
or
object.key = value
, except that it provides support for computed
properties, the setUnknownProperty()
method and property observers.
### Computed Properties
If you try to set a value on a key that has a computed property handler
defined (see the get()
method for an example), then set()
will call
that method, passing both the value and key instead of simply changing
the value itself. This is useful for those times when you need to
implement a property that is composed of one or more member
properties.
### Unknown Properties
If you try to set a value on a key that is undefined in the target
object, then the setUnknownProperty()
handler will be called instead. This
gives you an opportunity to implement complex "virtual" properties that
are not predefined on the object. If setUnknownProperty()
returns
undefined, then set()
will simply set the value on the object.
### Property Observers
In addition to changing the property, set()
will also register a property
change with the object. Unless you have placed this call inside of a
beginPropertyChanges()
and endPropertyChanges(),
any "local" observers
(i.e. observer methods declared on the same object), will be called
immediately. Any "remote" observers (i.e. observer methods declared on
another object) will be placed in a queue and called at a later time in a
coalesced manner.
### Chaining
In addition to property changes, set()
returns the value of the object
itself so you can do chaining like this:
`
javascript
record.set('firstName', 'Charles').set('lastName', 'Jolley');
`
Parameters:
-
keyName
StringThe property to set -
value
ObjectThe value to set ornull
.
Returns:
setProperties
-
hash
beginPropertyChanges
and endPropertyChanges
batch, so
observers will be buffered.
`
javascript
record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });
`
Parameters:
-
hash
Hashthe hash of keys and values to set
Returns:
setUnknownProperty
-
key
-
value
Parameters:
-
key
Object -
value
Object
toggleProperty
-
keyName
`
javascript
starship.toggleProperty('warpDriveEngaged');
`
Parameters:
-
keyName
StringThe name of the property to toggle
Returns:
toString
()
String
toString
typically does, in a generic way for all Ember
objects.
`
javascript
App.Person = Em.Object.extend()
person = App.Person.create()
person.toString() //=> "`
If the object's class is not defined on an Ember namespace, it will
indicate it is a subclass of the registered superclass:
`
javascript
Student = App.Person.extend()
student = Student.create()
student.toString() //=> "<(subclass of App.Person):ember1025>"
`
If the method toStringExtension
is defined, its return value will be
included in the output.
`
javascript
App.Teacher = App.Person.extend({
toStringExtension: function() {
return this.get('fullName');
}
});
teacher = App.Teacher.create()
teacher.toString(); //=> "`
Returns:
trigger
-
name
Ember.Evented
to
also call methods with the given name.
Parameters:
-
name
String
willDestroy
()
willMergeMixin
()
private
actions
to _actions
at extend time. Note that this currently
modifies the mixin themselves, which is technically dubious but
is practically of little consequence. This may change in the future.
Properties
_context
Unknown
private
parentView
's context (for a child of a ContainerView)
The code in Handlebars that overrides the _context
property first
checks to see whether the view has a specified controller. This is
something of a hack and should be revisited.
actions
Hash
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.:
`
js
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:
`
js
App.SongRoute = Ember.Route.extend({
actions: {
myAction: function() {
this.controllerFor("song");
this.transitionTo("other.route");
...
}
}
});
`
It is also possible to call this._super()
from within an
action handler if it overrides a handler defined on a parent
class or mixin:
Take for example the following routes:
`
js
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();
// 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:
`
js
App.Router.map(function() {
this.resource("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;
}
}
}
});
`
Default: null
ariaRole
String
Default: null
attributeBindings
Unknown
`
javascript
// Applies the type attribute to the element
// with the value "button", like `
If the value of the property is a Boolean, the name of that property is
added as an attribute.
`
javascript
// Renders something like `
childViews
Array
private
appendChild
and removeFromParent
.
Default: []
classNameBindings
Array
`
javascript
// 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.
`
javascript
// 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:
`
javascript
// 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.
Default: []
classNames
Array
Default: ['ember-view']
concatenatedProperties
Array
classNames
property of Ember.View
.
Here is some sample code showing the difference between a concatenated
property and a normal one:
`
javascript
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:
`
javascript
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:
`
javascript
var view = App.FooBarView.create({
classNames: 'baz'
})
view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz']
`
Using the concatenatedProperties
property, we can tell to Ember that 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).
Default: null
context
Object
controller
Object
displayTemplate
Function
The template to render when shouldDisplayFunc
evaluates to true
.
Default: null
element
DOMElement
inverseTemplate
Function
The template to render when shouldDisplayFunc
evaluates to false
.
Default: null
isDestroyed
Unknown
true
the observers and bindings were already
removed by the effect of calling the destroy()
method.
Default: false
isDestroying
Unknown
destroy()
method has been called.
The object stays intact until the end of the run loop at which point
the isDestroyed
flag is set.
Default: false
isVisible
Boolean
false
, the view will appear hidden in DOM.
Default: null
layout
Function
template
property during rendering. It is the
responsibility of the layout template to retrieve the template
property from the view (or alternatively, call Handlebars.helpers.yield
,
{{yield}}
) to render it in the correct location.
This is useful for a view that has a shared wrapper, but which delegates
the rendering of the contents of the wrapper to the template
property
on a subclass.
layoutName
String
Ember.View
will lookup a template with this name in
Ember.TEMPLATES
(a shared global object).
Default: null
parentView
Ember.View
Default: null
path
String
The path to look up on pathRoot
that is passed to
shouldDisplayFunc
to determine which template to render.
In addition, if preserveContext
is false,
the object at this path will
be passed to the template when rendering.
Default: null
pathRoot
Object
The object from which the path
will be looked up. Sometimes this is the
same as the previousContext
, but in cases where this view has been
generated for paths that start with a keyword such as view
or
controller
, the path root will be that resolved object.
preserveContext
Boolean
Whether the template rendered by this view gets passed the context object
of its parent template, or gets passed the value of retrieving path
from the pathRoot
.
For example, this is true when using the {{#if}}
helper, because the
template inside the helper should look up properties relative to the same
object as outside the block. This would be false
when used with {{#with foo}}
because the template should receive the object found by evaluating
foo
.
Default: false
previousContext
Object
If preserveContext
is true, this is the object that will be used
to render the template.
shouldDisplayFunc
Function
The function used to determine if the displayTemplate
or
inverseTemplate
should be rendered. This should be a function that takes
a value and returns a Boolean.
Default: null
tagName
String
tagName
for an element, you
must destroy and recreate the view element.
By default, the render buffer will use a <div>
tag for views.
Default: null
template
Function
templateName
property instead of setting
the template yourself.
templateName
String
Ember.View
will lookup a template with this name in
Ember.TEMPLATES
(a shared global object).
Default: null