Created
January 21, 2015 03:06
-
-
Save pzuraq/4180624ac114ec58bbfb to your computer and use it in GitHub Desktop.
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
// verses.js - controller | |
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
export default Ember.ObjectController.extend({ | |
actions: { | |
getAnotherVerse: function() { | |
// Here you need to understand a little bit about promises. A promise is | |
// asynchronous, so in you need to use .then() to get the value of the | |
// promise that is returned. | |
var controller = this; | |
this.store.find('verse', '0').then(function(verse) { | |
controller.set('model', verse); | |
}); | |
} | |
} | |
}); |
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
// verses.js - router | |
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model: function() { | |
// You need to return the model in this function. In this case, | |
// you are returning a promise that resolves to your model. | |
return this.store.find('verse', '0'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment