Created
October 26, 2016 00:35
-
-
Save nhooyr/4f21006394521c6887fba5097cc28faf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html ng-app="radioGraydonApp"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Announcements</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
| <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> | |
| <script> | |
| var radioGraydonApp = angular.module('radioGraydonApp', []) | |
| radioGraydonApp.controller('AnnouncementCtrl', function($scope, $http) { | |
| // get list of announcements | |
| $http.get("https://radiograydon.aubble.com/announcements").then(function(response) { | |
| $scope.announcements = response.data | |
| console.log("success") | |
| }, function(response) { | |
| console.log(response) | |
| }) | |
| // add new announcement | |
| $http.post("https://radiograydon.aubble.com/announcements", { | |
| date: new Date(), | |
| title: "omar xdxd", | |
| body: "I WILL BE HOKAGE" | |
| }, { | |
| headers: { | |
| Authorization: "Basic b21hcjp4eER4eER4eA==" | |
| } | |
| }).then(function(response) { | |
| console.log("success") | |
| }, function(response) { | |
| console.log(response) | |
| }) | |
| // update existing announcement | |
| $http.put("https://radiograydon.aubble.com/announcements/11", { | |
| date: new Date(), | |
| title: "WOOOWOWOAOA", | |
| body: "JXJSDJIDSJIDJIOSDJIDSOJ" | |
| }, { | |
| headers: { | |
| Authorization: "Basic b21hcjp4eER4eER4eA==" | |
| } | |
| }).then(function(response) { | |
| console.log("success") | |
| }, function(response) { | |
| console.log(response) | |
| }) | |
| // delete an announcement | |
| $http.delete("https://radiograydon.aubble.com/announcements/15", { | |
| headers: { | |
| Authorization: "Basic b21hcjp4eER4eER4eA==" | |
| } | |
| }).then(function(response) { | |
| console.log("success") | |
| }, function(response) { | |
| console.log(response) | |
| }) | |
| }) | |
| </script> | |
| </head> | |
| <body ng-controller="AnnouncementCtrl"> | |
| <br><br> | |
| <h1 class="text-center">Announcements</h1> | |
| <br><br> | |
| <table align="center" style="width: 90%" class="table table-bordered"> | |
| <tr> | |
| <th>Id</th> | |
| <th>Title</th> | |
| <th>Body</th> | |
| <th>Date</th> | |
| </tr> | |
| <tr ng-repeat="announcement in announcements"> | |
| <td>{{announcement.id}}</td> | |
| <td>{{announcement.title}}</td> | |
| <td>{{announcement.body}}</td> | |
| <td>{{announcement.date}}</td> | |
| </tr> | |
| </table> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment