Skip to content

Instantly share code, notes, and snippets.

@sultaniman
Last active June 10, 2016 15:04
Show Gist options
  • Select an option

  • Save sultaniman/97657ed79ea375b87831efc4a12906b6 to your computer and use it in GitHub Desktop.

Select an option

Save sultaniman/97657ed79ea375b87831efc4a12906b6 to your computer and use it in GitHub Desktop.
prop function
import Ember from 'ember';
const {on, get} = Ember;
let prop = function(key) { return get(this, key) };
export default Ember.Component.extend({
onElementInsert: on('didInsertElement', function() {
// In this place we just bind components context
// to a `prop` function
prop = prop.bind(this);
}),
_doSomething() {
// use it
let getSomething = prop('something');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment