Skip to content

Instantly share code, notes, and snippets.

@mattmazzola
Created April 12, 2016 06:08
Show Gist options
  • Save mattmazzola/481e90071ad7bbfb60e69914f15b041e to your computer and use it in GitHub Desktop.
Save mattmazzola/481e90071ad7bbfb60e69914f15b041e to your computer and use it in GitHub Desktop.
Angular 1.5x Component
class Controller {
$element: ng.IAugmentedJQuery;
$scope: ng.IScope;
$timeout: ng.ITimeoutService;
MyService: MyService;
static $inject = [
'$scope',
'$element',
'$attrs',
'$timeout',
'MyService'
]
constructor($scope: ng.IScope, $element: ng.IAugmentedJQuery, $attrs, $timeout: ng.ITimeoutService, MyService: MyService) {
this.$scope = $scope;
this.$element = $element;
this.$timeout = $timeout;
this.MyService = MyService;
}
submitClicked(thing: Thing): ng.IPromise<Thing> {
return this.MyService.save(thing);
}
...
}
const Component = {
templateUrl: "/App/components/my-component/template.html",
controller: Controller;
controllerAs: 'vm';
bindings: {
name: "<"
}
}
export default Component;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment