Skip to content

Instantly share code, notes, and snippets.

@Danyboy
Last active July 10, 2017 19:25
Show Gist options
  • Select an option

  • Save Danyboy/ca9f27905d9f898937ed26653fc797aa to your computer and use it in GitHub Desktop.

Select an option

Save Danyboy/ca9f27905d9f898937ed26653fc797aa to your computer and use it in GitHub Desktop.
Angular bugs
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>Today's welcome message is:</p>
<h1>{{myWelcome}}</h1>
</div>
<p>The $http service requests a page on the server, and the response is set as the value of the "myWelcome" variable.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("https://api.github.com/repos/angular/angular/issues")
.then(function(response) {
$scope.myWelcome = [];
angular.forEach(response.data, function(value, key) {
if (value && value.labels[0] && value.labels[0].color){
this.push(key + ': ' + value.labels[0].color);
}
}, $scope.myWelcome);
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment