ES6 and variable scope inside a promise
Not sure what I'm missing here. I need to get the output of data into this.contact . Right now, I'm using a static class variable, but it seems dirty to have to do that. export class contactEdit { static t; // static class var constructor() { this.id = null; this.contact = null; contactEdit.t = this; } activate(id) { this.id = id; let contact = this.contact; // scoped version of class var return dpd.contacts.get(id).then(function(data) { console.log(data); contactEdit.t.contact = data; // this works contact = data; // this doesn't }); } } Normally I would create a var contact inside the