Last active
August 24, 2016 16:31
-
-
Save k-fish/73c292481820dad8eaf2fdbbce26d29b to your computer and use it in GitHub Desktop.
Transition refresh example (refresh post transition promise works)
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({ | |
appName: 'Ember Twiddle' | |
}); |
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'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('main', { resetNamespace: true, path: ''}, function() { | |
this.route('a-route', {path: 'a-route/:id'}); | |
this.route('b-route'); | |
}); | |
}); | |
export default Router; |
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'; | |
let inc = 0; | |
export default Ember.Route.extend({ | |
model() { | |
inc = inc + 1; | |
return Ember.RSVP.resolve({inc: inc}); | |
}, | |
afterModel(model) { | |
model.inc = model.inc + 0.01; | |
}, | |
actions: { | |
didTransition() { | |
inc = inc + 1; | |
this.set('controller.model.inc', inc); | |
}, | |
}, | |
}); |
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'; | |
let id = 1; | |
export default Ember.Route.extend({ | |
actions: { | |
trans(loc) { | |
//id = 1 - id; | |
this.transitionTo(loc, id).then(() => { | |
this.refresh(); | |
}); | |
}, | |
} | |
}); |
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.10.4", | |
"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.7.0", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "2.7.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment