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)
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)