var myApp = angular.module('inventoryApp', []); myApp.controller('juniper', function($scope, $http) { $scope.routers = []; $scope.router = ''; $scope.interfaces = 'not yet loaded'; $scope.bgp = 'not yet loaded'; $scope.snmp = 'not yet loaded'; $http({ method: 'GET', url: window.location.origin + "/data/routers" }).then( function(rsp) {$scope.routers = rsp.data;}, function(rsp) {$scope.routers = ['error'];} ); $scope.update_interface = function() { $http({ method: 'GET', url: window.location.origin + "/data/interfaces/" + $scope.router }).then( function(rsp) {$scope.interfaces = rsp.data;}, function(rsp) {$scope.interfaces = 'error';} ); $http({ method: 'GET', url: window.location.origin + "/data/bgp/" + $scope.router }).then( function(rsp) {$scope.bgp = rsp.data;}, function(rsp) {$scope.bgp = 'error';} ); $http({ method: 'GET', url: window.location.origin + "/data/snmp/" + $scope.router }).then( function(rsp) {$scope.snmp = rsp.data;}, function(rsp) {$scope.snmp = 'error';} ); } });