import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save: function() {
var controller = this;
this.get("model").save().then(function(){
controller.transitionToRoute('<%= dasherizedModuleName %>.show')
})
}
}
})
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save() {
this.get("model").save().then(()=>{
this.transitionToRoute('<%= dasherizedModuleName %>.show')
})
}
}
})
//"Classic"
save: function(){}
//ES2015
save(){}
//"Classic"
save: function(arg1){}
//ES2015
save(arg1){}
//"Classic"
var controller = this;
this.save().then(function(){
controller.doThing()
})
//ES2015
this.save().then(()=>{
this.doThing()
})
//"Classic"
shouldWearHat: Ember.computed('wind', function(){
return this.get('wind') > 3;
})
//ES2015
shouldWearHat: Ember.computed('wind', ()=>{
return this.get('wind') > 3;
//Oops! 'this' now refers to window
})
//ES2016 + ember-computed-decorators
@computed('wind')
shouldWearHat(){
return this.get('wind') > 3;
}
//"Classic"
shouldWearHat: Ember.computed('wind', function(){
return this.get('wind') > 3;
})
//ES2015
shouldWearHat: Ember.computed('wind', ()=>{
return this.get('wind') > 3;
//Oops! 'this' now refers to window
})
//ES2016 (decorators)
@computed('wind')
shouldWearHat(){
return this.get('wind') > 3;
}
//Yes, I know you can use Ember.computed.gt
export default Ember.Controller.extend({
actions: {
save: function() {
var controller = this;
this.get("model").save().then(function(){
controller.transitionToRoute('<%= dasherizedModuleName %>.show')
})
}
}
})
export default Ember.Controller.extend({
actions: {
save() {
this.get("model").save().then(()=>{
this.transitionToRoute('<%= dasherizedModuleName %>.show')
})
}
}
})