Last active
October 4, 2016 19:45
-
-
Save baroquon/f734c834c3c03258e7d790cd0f57575d to your computer and use it in GitHub Desktop.
checked thingy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
locations: [ | |
Ember.Object.create({id: 1,name: `me - 1`, merchantId: 1 }), | |
Ember.Object.create({id: 2,name: `me - 2`, merchantId: 1 }), | |
Ember.Object.create({id: 3,name: `me - 3`, merchantId: 2 }), | |
Ember.Object.create({id: 4,name: `me - 4`, merchantId: 2 }), | |
], | |
searchTerm: null, | |
locationsObject: Ember.computed('locations', 'searchTerm', function() { | |
let _obj = []; | |
this.get('locations').forEach((location) => { | |
let locObj = { | |
id: location.get('id'), | |
name: `${location.get('name')} - ${location.get('merchantId')}`, | |
checked:true, | |
merchantId: location.get('merchantId') | |
}; | |
_obj.push(locObj); | |
}); | |
return _obj; | |
}), | |
checked: Ember.computed('[email protected]', function() { | |
let _checked = []; | |
this.get('locationsObject').forEach((_location) => { | |
if (_location.checked) { | |
_checked.push(_location.id); | |
} | |
}); | |
return _checked; | |
}), | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment