From 8890eaae0aa9219e111b2864847a6b8746942054 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Thu, 13 Dec 2018 21:09:37 +0100 Subject: [PATCH] basic angular test --- inventory_provider/static/demo.html | 16 +++++++++++++++ .../static/inventoryProvider.js | 20 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 inventory_provider/static/demo.html create mode 100644 inventory_provider/static/inventoryProvider.js diff --git a/inventory_provider/static/demo.html b/inventory_provider/static/demo.html new file mode 100644 index 00000000..369df4fc --- /dev/null +++ b/inventory_provider/static/demo.html @@ -0,0 +1,16 @@ +<!doctype html> +<html ng-app="inventoryApp"> + <head> + <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script> + <script src="inventoryProvider.js"></script> + <link rel="stylesheet" href="todo.css"> + </head> + <body> + <h2>Todo</h2> + <div ng-controller="inventoryProvider"> + <ul name="routers" class="unstyled"> + <li ng-repeat="router in routers">{{router}}</li> + </ul> + </div> + </body> +</html> \ No newline at end of file diff --git a/inventory_provider/static/inventoryProvider.js b/inventory_provider/static/inventoryProvider.js new file mode 100644 index 00000000..df3ec25a --- /dev/null +++ b/inventory_provider/static/inventoryProvider.js @@ -0,0 +1,20 @@ +var myApp = angular.module('inventoryApp', []); + +myApp.controller('inventoryProvider', function($scope, $http) { + + $scope.routers = [] + + function onSuccess(response) { + $scope.routers = response.data; + } + + function onError(response) { + $scope.routers = ['error']; + } + + $http({ + method: 'GET', + url: 'http://localhost:7878/data/routers' + }).then(onSuccess, onError); +console.log("HERE2"); +}); \ No newline at end of file -- GitLab