Skip to content

Instantly share code, notes, and snippets.

@courajs
Last active November 4, 2015 20:45
Show Gist options
  • Save courajs/bf8480ae881806edc9d4 to your computer and use it in GitHub Desktop.
Save courajs/bf8480ae881806edc9d4 to your computer and use it in GitHub Desktop.
app/computed-property-macros/hash.js
import Ember from 'ember';
import hash from 'app/computed-property-macros/hash';
const {
Component
} = Ember;
export default Component.extend({
order: hash('price', 'count')
});
import Ember from 'ember';
const {
computed,
get
} = Ember;
export default function(...props) {
return computed(...props, function(){
let result = {};
props.forEach((prop) => {
result[prop] = get(this, prop);
});
return result;
});
}
<label>Price: {{input value=price}}</label>
<label>Count: {{input value=count}}</label>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment