Skip to content

Instantly share code, notes, and snippets.

@alatzl
Last active August 29, 2015 14:19
Show Gist options
  • Save alatzl/51743a0be42470c82b61 to your computer and use it in GitHub Desktop.
Save alatzl/51743a0be42470c82b61 to your computer and use it in GitHub Desktop.
Writing Angular with Migration in Mind: Ex. 1
angular.module('myModule')
.service('addresses', ['addressService', '$q', Addresses]);
class Addresses {
constructor(addressService, $q) {
this.$q = $q;
this.addressService = addressService;
this.prefix = "My Address: "
}
printAddress() {
return this.$q((resolve, reject) => {
addressService.getFullAddress((addr) => {
resolve(this.prefix + addr);
}, reject);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment