AngularJS service $http

Stiahnutie JSON tabuľky.

Tabuľka obsahuje zoznam AVR mikrokontrolérov, ktoré majú doplňujúce údaje pre potreby tejto stránky.
MCU (http status:{{status}})
{{x}}

script

<script src=https://ajax.googleapis.com/ajax/libs/angularjs/1.6.2/angular.min.js></script>

service-http.html

<div ng-app="myApp" ng-controller="myCtrl">
    <table class="table">
        <tr>
            <th>MCU (http status:{{status}})</th>
        </tr>
        <tr ng-repeat="x in mcu | orderBy">
            <td>{{x}}</td>
        </tr>
    </table>

</div>

service-http.js

var app = angular.module('myApp', []);

app.controller('myCtrl', ['$scope', '$http', function($scope, $http) {

    $scope.mcu = [''];

    /* list.json
    {
    "list": [
        "ATtiny13A",
        "ATtiny85"
        ]
    }
    */
    $http.get('/application/data/avr/list.json').
        then(function(response) {
          $scope.status = response.status;
          $scope.mcu = response.data.list;
        }, function(response) {
          $scope.mcu = ['Request failed'];
          $scope.status = response.status;
    });

}]);