Last active
November 23, 2016 22:53
-
-
Save sptq/6eb1da844eb6b023dd9a04264a113e51 to your computer and use it in GitHub Desktop.
Angular 1.5.x Controller Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Lodash version | |
*/ | |
import {assign, each} from 'lodash'; | |
export default class ResourceLookupController { | |
constructor() { | |
each(arguments, (o, i) => assign(this, {[this.constructor.$inject[i]] : o})); | |
this.name = 'resource-lookup'; | |
} | |
sendGet() { | |
this.output = this.resourceLookupService.doGetRequest() | |
} | |
scopeManipulation() { | |
this.$scope.test = 'test'; | |
} | |
} | |
ResourceLookupController.$inject = ['$scope', 'resourceLookupService']; | |
/** | |
* Vanilla JS version | |
*/ | |
export default class ResourceLookupController { | |
constructor() { | |
[...arguments].forEach((o, i) => Object.assign(this, {[this.constructor.$inject[i]] : o})); | |
this.name = 'resource-lookup'; | |
} | |
sendGet() { | |
this.output = this.resourceLookupService.doGetRequest() | |
} | |
} | |
ResourceLookupController.$inject = ['resourceLookupService']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment