abuiles / ember-cli-101-errata

18 stars 4 forks source link

old save function in Friend Edit Controller on p.37 #236

Open anjuliw opened 9 years ago

anjuliw commented 9 years ago

the save function in the Friend New Controller (p.31) uses arrow notation for the anonymous function: save() { if (this.get('isValid')) { this.get('model').save().then((friend) => { this.transitionToRoute('friends.show', friend); }); }

but the next time the 'same' save function is implemented in Friend Edit Controller (p.37), it uses the older clunky _this=this: save() { if (this.get('isValid')) { var _this = this; this.get('model').save().then(function(friend) { _this.transitionToRoute('friends.show', friend); }); }

(sry can't get those newlines to show in the code blocks)