Ember.getWithDefault()

getWithDefault (obj, keyName, defaultValue) Objectpublic

Defined in packages/ember-metal/lib/property_get.js:106

Retrieves the value of a property from an Object, or a default value in the case that the property returns undefined.

Ember.getWithDefault(person, 'lastName', 'Doe');

Parameters:

obj Object
The object to retrieve from.
keyName String
The name of the property to retrieve
defaultValue Object
The value to return if the property value is undefined

Returns:

Object
The property value or the defaultValue.
doc_EmberJs
2016-11-30 16:51:28
Comments
Leave a Comment

Please login to continue.