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.
- app.service("TopMenuService", function ($http) {
- this.getTopMenu = function () {
- debugger;
- return $http.get("/employee/getTopMenu");
- };
- });
-
- app.service("LeftMenuService", function ($http) {
- this.getLeftMenu = function () {
- debugger;
- return $http.get("/employee/getLeftMenu");
- };
- });
-
- app.controller("EmpCtrl", function ($scope, TopMenuService,LeftMenuService) {
-
- GetTopMenu();
- GetLeftMenu();
-
- function GetTopMenu() {
-
- debugger;
- var _getTopMenu = EmployeeService.getTopMenu();
- _getTopMenu.then(function (topmenu) {
- $scope.topmenu = topmenu.data;
- }, function () {
- alert('Data not found');
- });
- }
-
- function GetLeftMenu() {
-
- debugger;
- var _getLeftMenu = EmployeeService.getLeftMenu();
- _getLeftMenu.then(function (leftmenu) {
- $scope.leftmenu = leftmenu.data;
- }, function () {
- alert('Data not found');
- });
- }
- });