Created
July 30, 2017 15:42
-
-
Save carlosrymer/551f9c7ea87e6576773f325c2cd81639 to your computer and use it in GitHub Desktop.
A sample ES6 Angular 1.x, class-based controller.
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
class SampleCtrl { | |
constructor($scope, Service1, Service2) { | |
'ngInject'; | |
this.$scope = $scope; | |
this.Service1 = Service1; | |
this.Service2 = Service2; | |
$scope.$on('event:sample1', () => this.doSomethingOne()); | |
$scope.$on('event:sample2', () => this.doSomethingTwo()); | |
} | |
doSomethingOne() { | |
this.Service1.exec(); | |
} | |
doSomethingTwo() { | |
this.Service2.exec(); | |
} | |
} | |
export default SampleCtrl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment