tri_inn

tri_inn

  • NA
  • 1.2k
  • 233.5k

loading different area in page by angular

Apr 26 2017 10:54 AM
suppose when first time web site load then i need to load left and top menu.
 
both menu will load independently and so anyone may load and show first.
so tell me the trick which i need to apply to show both left and top menu at same time if top or left menu load first. some how i need to show both the menu at same time.
 
tell me what code i need to change in below. below code is just a sample code and not tested.
  1. app.service("TopMenuService"function ($http) {  
  2.     this.getTopMenu = function () {  
  3.         debugger;  
  4.         return $http.get("/employee/getTopMenu");  
  5.     };  
  6. });  
  7.   
  8. app.service("LeftMenuService"function ($http) {  
  9.     this.getLeftMenu = function () {  
  10.         debugger;  
  11.         return $http.get("/employee/getLeftMenu");  
  12.     };  
  13. });  
  14.   
  15. app.controller("EmpCtrl"function ($scope, TopMenuService,LeftMenuService) {  
  16.   
  17.     GetTopMenu();  
  18.     GetLeftMenu();  
  19.       
  20.     function GetTopMenu() {  
  21.   
  22.         debugger;  
  23.         var _getTopMenu = EmployeeService.getTopMenu();  
  24.         _getTopMenu.then(function (topmenu) {  
  25.             $scope.topmenu = topmenu.data;  
  26.         }, function () {  
  27.             alert('Data not found');  
  28.         });  
  29.     }  
  30.       
  31.     function GetLeftMenu() {  
  32.   
  33.         debugger;  
  34.         var _getLeftMenu = EmployeeService.getLeftMenu();  
  35.         _getLeftMenu.then(function (leftmenu) {  
  36.             $scope.leftmenu = leftmenu.data;  
  37.         }, function () {  
  38.             alert('Data not found');  
  39.         });  
  40.     }      
  41. }); 
 

Answers (4)