Skip to content

Instantly share code, notes, and snippets.

@finalcut
Created November 10, 2015 13:39
Show Gist options
  • Save finalcut/2487635df0d1ff3ec410 to your computer and use it in GitHub Desktop.
Save finalcut/2487635df0d1ff3ec410 to your computer and use it in GitHub Desktop.
Angular 1.x ES 6 Service using babel stage 0
export default class ExampleService {
// you can do this in a controller as well. In fact, I do!
static $inject = ['$http'];
constructor($http) {
this.$http = $http;
}
// Example service function
getData () {
return this.$http({method: 'GET', url: './api' });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment