Current weather example

by emilcieslar

HTML

<div ng-app="WeatherApp" ng-controller="mainController as main">
  <h2>
    Current weather: {{main.currentWeather.description}}
  </h2>
  <p>
    It's {{main.currentWeather.temperature}} celsius now, with wind speed of {{main.currentWeather.windSpeed}} m/s.
  </p>
</div>

JavaScript

angular.module('WeatherApp', [])

    .controller('mainController', [function () {
        
        var self = this;
        
        self.currentWeather = {
            description: 'Nice',
            temperature: 24,
            windSpeed: 20
        }
        
    }]);