-
-
Save jameshahn2/979433311e92a71cea721dfda77b0ea3 to your computer and use it in GitHub Desktop.
Discipline - Groups
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.Component.extend({ | |
disciplineGroups: Ember.computed('discipline', function(){ | |
return this.get('disciplines').filter(discipline => discipline.disciplineId === this.get('discipline')); | |
}) | |
/* | |
groupsFiltered: Ember.computed('discipline', 'search', function () { | |
var groups = this.get('groups'); | |
var search = this.get('search'); | |
console.log('computed groupsFiltered() with discipline: ' + this.get('discipline') + ', search: ' + search); | |
return groups.filter((item) => item['disciplineId'] === this.get('discipline')); | |
// or this when I search, but I don't know how to do: | |
// return groups.filter((item) => item['name'].includes(search)) | |
}) */ | |
}); |
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', | |
discipline: null, | |
disciplines: [ | |
{ | |
group: 'drilling', | |
id: 1 | |
}, | |
{ | |
group: 'geology', | |
id: 2 | |
}, | |
{ | |
group: 'geophysics', | |
id: 3 | |
}, | |
{ | |
group: 'formation_evaluation', | |
id: 4 | |
} | |
] | |
}); |
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.11.1", | |
"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.11.0", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.11.0", | |
"ember-testing": "2.11.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment