Last active
April 25, 2018 09:45
-
-
Save mansona/f7e9fcdc4fe6f9205de63471a25e7fd1 to your computer and use it in GitHub Desktop.
May I ask a Question - 001
This file contains 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({ | |
filteredModel: Ember.computed('filterValue', 'model.@each.name', function() { | |
if(Ember.isEmpty(this.get('filterValue'))) { | |
return this.model; | |
} | |
return this.model.filter((test) => test.get('name') === this.get('filterValue')); | |
}), | |
actions: { | |
filterByTestName: function(name) { | |
this.set('filterValue', name); | |
} | |
} | |
}); |
This file contains 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 Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
import { belongsTo, hasMany } from 'ember-data/relationships'; | |
export default Model.extend({ | |
}); |
This file contains 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'; | |
function makeTestRecord(context, name){ | |
context.get('store').createRecord('test', { | |
name, | |
}); | |
} | |
export default Ember.Route.extend({ | |
model() { | |
makeTestRecord(this, 'first test'); | |
makeTestRecord(this, 'first test'); | |
makeTestRecord(this, 'face'); | |
makeTestRecord(this, 'face'); | |
makeTestRecord(this, 'face'); | |
makeTestRecord(this, 'face'); | |
makeTestRecord(this, 'last test'); | |
return this.get('store').peekAll('test'); | |
} | |
}); | |
This file contains 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.13.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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment