Last active
December 12, 2015 23:58
-
-
Save desaroxx/61600137b57bf1d75afa to your computer and use it in GitHub Desktop.
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
namespace app.directives.weather { | |
class WeatherController { | |
public static $inject: Array<string> = ["temperatureService"]; | |
public currentTemperature: number; | |
constructor(private temperatureService: app.services.TemperatureService) { | |
this.loadTemperature(); | |
} | |
private loadTemperature(): void { | |
this.temperatureService.getTemperature() | |
.then((temp) => { | |
this.currentTemperature = temp; | |
}); | |
} | |
} | |
angular.module("app").directive("weather", (): ng.IDirective => { | |
return { | |
restrict: 'E', | |
controller: WeatherController, | |
controllerAs: 'weatherCtrl', | |
templateUrl: 'directives/weather/weather-template.html' | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment