Last active
April 12, 2016 06:18
-
-
Save mattmazzola/dd19763cc01cae02595956443712c2bd to your computer and use it in GitHub Desktop.
Angular 1.4x Component
This file contains hidden or 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
class Controller { | |
$scope: ng.IScope; | |
$timeout: ng.ITimeoutService; | |
MyService: MyService; | |
static $inject = [ | |
'$scope', | |
'$timeout', | |
'MyService' | |
] | |
constructor($scope: ng.IScope, $timeout: ng.ITimeoutService, MyService: MyService) { | |
this.$scope = $scope; | |
this.$timeout = $timeout; | |
this.MyService = MyService; | |
} | |
submitClicked(thing: Thing) { | |
return this.MyService.save(thing); | |
} | |
... | |
} | |
export default class Component { | |
restrict = 'E'; | |
bindToController = true; | |
templateUrl = "/App/components/my-component/template.html"; | |
controller = Controller; | |
controllerAs = 'vm'; | |
scope = { | |
name: "=" | |
} | |
link($scope: ng.IScope, element: ng.IAugmentedJQuery, $attrs, controller: Controller) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment