Skip to content

Instantly share code, notes, and snippets.

@desaroxx
Last active December 12, 2015 17:02
Show Gist options
  • Save desaroxx/d6d386952a9f3b6768e5 to your computer and use it in GitHub Desktop.
Save desaroxx/d6d386952a9f3b6768e5 to your computer and use it in GitHub Desktop.
Angular Controller written in Typescript
class HomeController {
public static $inject: Array<string> = ["$timeout"];
public pageTitle: string = "Home";
private name: string = "John Doe";
constructor(private $timeout: ng.ITimeoutService) {}
public sayHello(): void {
this.$timeout(() => {
console.log("HI " + this.makeItUpperCase(this.name));
}, 10);
}
private makeItUpperCase(input: string): string {
return input.toUpperCase();
}
}
angular.module("app", []).controller("homeCtrl", HomeController);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment