Skip to content

Instantly share code, notes, and snippets.

@auser
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auser/3917436d8a6f0fcfc455 to your computer and use it in GitHub Desktop.
Save auser/3917436d8a6f0fcfc455 to your computer and use it in GitHub Desktop.
angular.module('myApp', [])
.controller('HomeController', function($scope) {
// Fill in the blanks to get weather
// on to the scope
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blank</title>
</head>
<body>
<div ng-controller='HomeController'>
<div class="weather">
The weather is {{ weather.temperature }}
</div>
</div>
<script src="js/angular.js"></script>
<script src="js/app.js"></script>
</body>
</html>
var getData = function(q) {
var url = "http://api.openweathermap.org/data/2.5/"+
"forecast/daily?mode=json" +
"&units=imperial&cnt=1" +
"&q="
return $http({
method: 'JSONP',
url: url + q,
params: {
callback: 'JSON_CALLBACK'
}
}).success(function(data, status) {
return data;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment