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.

Revisions

  1. Danyboy revised this gist Jul 10, 2017. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions ab.html
    Original file line number Diff line number Diff line change
    @@ -18,12 +18,12 @@ <h1>{{myWelcome}}</h1>
    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);
    $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>
  2. Danyboy created this gist Jul 10, 2017.
    32 changes: 32 additions & 0 deletions ab.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    <!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>