diff --git a/src/main/webdemo/www/deal.html b/src/main/webdemo/www/deal.html index c1a3416deb..edec8da699 100644 --- a/src/main/webdemo/www/deal.html +++ b/src/main/webdemo/www/deal.html @@ -1,5 +1,5 @@ - + @@ -10,14 +10,20 @@ IRS Deal Viewer - - + + + + + - +
+
+
Loading
+
diff --git a/src/main/webdemo/www/js/app.js b/src/main/webdemo/www/js/app.js index 97638c271a..ba0bc65525 100644 --- a/src/main/webdemo/www/js/app.js +++ b/src/main/webdemo/www/js/app.js @@ -9,9 +9,12 @@ let nodeService = irsViewer.factory('nodeService', ($http) => { var load = (type, promise) => { curLoading[type] = true; - return promise.then((arg1) => { + return promise.then((arg) => { curLoading[type] = false; - return arg1; + return arg; + }, (arg) => { + curLoading[type] = false; + throw arg; }); } @@ -55,7 +58,13 @@ let nodeService = irsViewer.factory('nodeService', ($http) => { return load('deals', $http.get('http://localhost:31338/api/irs/deals')).then((resp) => { return resp.data; }); - } + }; + + this.getDeal = (dealId) => { + return load('deal' + dealId, $http.get('http://localhost:31338/api/irs/deals/' + dealId)).then((resp) => { + return resp.data; + }); + }; this.getDateModel = (date) => { return { @@ -87,4 +96,10 @@ irsViewer.controller('HomeController', ($http, $scope, nodeService) => { nodeService.getDate().then((date) => $scope.date = date); nodeService.getDeals().then((deals) => $scope.deals = deals); -}) \ No newline at end of file +}); + +irsViewer.controller('DealController', ($http, $scope, nodeService) => { + $scope.isLoading = nodeService.isLoading; + + nodeService.getDeal('T000000001').then((deal) => $scope.deal = deal); +}); \ No newline at end of file