Last active
May 6, 2016 19:33
-
-
Save grapho/457cb6c0e222240a82511aa6e5295f2f to your computer and use it in GitHub Desktop.
save promise alias
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', | |
| isSaving: Ember.computed.alias('promise.isPending'), | |
| reason: Ember.computed.alias('promise.reason'), | |
| bork() { alert('thing borked!'); }, | |
| actions: { | |
| saveAThing() { | |
| let thing = this.store.createRecord('thing'); | |
| let saveThing = thing.save(); | |
| thing.on('becameError', () => { this.bork() } ); | |
| this.set('promise', saveThing); | |
| } | |
| } | |
| }); |
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 Model from 'ember-data/model'; | |
| export default Model.extend({ | |
| //becameError() { | |
| // alert('i borked!'); | |
| //} | |
| }); |
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.8.0", | |
| "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.5.1", | |
| "ember-data": "2.5.2", | |
| "ember-template-compiler": "2.5.1" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment