2017-02-27 56 views
0

我想用Angular 1.4開發一個應用程序(請參閱下圖)。我需要下面的建議RouteProvider和stateprovider一起在我的Angular 1應用程序

  • 什麼是在此開發主頁的最佳方式。我應該使用<ui-view>(UI路由)創建8個狀態,還是應該使用8個不同的自定義指令到選項卡(tab1,tab2,tab3等...)
  • 我的應用程序是否可以同時在配置文件中提供routeprovider和stateprovider 。(Another post from Stackoverflow

---------------------------------------- ----------------------------------->

我的意見/想法發展中國家--- - >

  • 將使用ng-view加載網頁(家庭,NAV2,nav3等)

  • 將使用ui-view加載內部主頁(TAB1,TAB2,TAB3等)

image for Angular 1.4 application

標籤/面板

回答

0

使用ng-viewui-view都不會在文件中顯示任何結果。即應用程序崩潰..所以我已經移動到ui-view顯示所有的狀態。

下面是可以正常工作的代碼。 Tutorial

.config(function($urlRouterProvider, $stateProvider) { 
 
     $urlRouterProvider.otherwise('/home'); 
 
     $stateProvider 
 
     .state("home", { 
 
      url:"/home", 
 
      views:{ 
 
      "":{ 
 
       templateUrl: "views/home.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/profile.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/company-announcement.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/leave-balance.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/leave-details.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/attendence-details.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/holiday-list.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/query-status.html" 
 
      }, 
 
      "[email protected]":{ 
 
       templateUrl: "views/home/payrol-query-status.html" 
 
      } 
 
      }//views ends here 
 
     }) 
 
     .state("login", { 
 
      url: "/login", 
 
      templateUrl: "views/login.html" 
 
     }) 
 
     .state("selfService", { 
 
      url:"/self-service", 
 
      views:{ 
 
      "":{ 
 
       templateUrl: "views/self-service.html" 
 
      } 
 
      } 
 
     }) 
 
     .state("edirectory", { 
 
      url: "/edirectory", 
 
      templateUrl: "views/edirectory.html", 
 
      controller: 'edirectoryController', 
 
      controllerAs: 'edirectoryCtrl', 
 
      resolve: { 
 
      employeeList: function (edirectoryService) { 
 
       return edirectoryService.getAllEmployees(); 
 
      } 
 
      } 
 
     }) 
 
     .state("myLeave", { 
 
      url: "/my-leave", 
 
      templateUrl: "views/my-leave.html" 
 
     }) 
 
     .state("attendence", { 
 
      url: "/attendence", 
 
      templateUrl: "views/attendence.html" 
 
     }) 
 
     .state("compOffRequest", { 
 
      url: "/comp-off-request", 
 
      templateUrl: "views/comp-off-request.html" 
 
     }) 
 
     .state("raiseQuery", { 
 
      url: "/raise-query", 
 
      templateUrl: "views/raise-query.html" 
 
     }) 
 
     .state("eacademy", { 
 
      url: "/eacademy", 
 
      templateUrl: "views/eacademy.html" 
 
     }) 
 
     .state("downloads", { 
 
      url: "/downloads", 
 
      templateUrl: "views/downloads.html" 
 
     }); 
 

 
    });

相關問題