2015-05-23 33 views
6

angularJS UI路由器工作的TabControl的是可見的,當應用程序啓動,但...請與角料設計TABS

當我點擊選項卡上沒有內容可見

什麼我錯了嗎?

我用的是最新的angularJS材料設計0.9.4。

$urlRouterProvider.otherwise(""); 
     $stateProvider 

      .state("main", 
      { 
      abtract: true, 
      url: '', 
      views: { 
       '[email protected]': { 
       templateUrl: '../app/views/administration/administration.html', 
       controller: 'AdministrationController' 
       } 
      } 
      }) 
      .state('main.settings', { 
      url: '/settings', 
      views: { 
       '[email protected]': { 
       templateUrl: "../app/views/administration/settings.html", 
       controller: 'GlobalConfigurationController' 
       } 
      } 
      }) 
      .state('main.schoolyears', { 
      url: '/schoolyears', 
      views: { 
       '[email protected]': { 
       templateUrl: "../app/views/schoolyear/schoolyears.html", 
       controller: 'SchoolyearsController' 
       } 
      } 
      }); 

HTML

<div layout-fill layout="column"> 
    <div ng-include="'app/components/navbar/navbar.html'"></div> 
    <div id="content" layout="column" layout-padding> 

    <md-tabs md-stretch-tabs="always" class="md-primary md-hue-2"> 

     <md-tab label="Schoolyears" ui-sref="main.schoolyears" md-active="$state.is('main.schoolyears')"> 
     <md-tab-body ui-view="schoolyears" layout="vertical" layout-fill></md-tab-body> 
     </md-tab> 

     <md-tab label="settings" ui-sref="main.settings" md-active="$state.is('main.settings')"> 
     <md-tab-body ui-view="settings" layout="vertical" layout-fill></md-tab-body> 
     </md-tab> 

    </md-tabs> 
    </div> 
</div> 
+0

你能後,你與

+0

你想要控制器代碼?或者知道我是否將控制器包含在index.html中? – HelloWorld

+0

需要了解兩者。 –

回答

5

更新:利用ui-srefmd-tabs固定在角材質0.10.0

一種解決方法已經公佈在github ,在previous known md-tab issue

有一個plunker與解決方法(它似乎沒有工作的意見):

$stateProvider 
     .state('tabs', { 
     abstract: true, 
     url: '/tabs', 
     templateUrl: 'tabs.html', 
     onEnter: function() { console.log("enter tabs.html"); } }) 

     .state('tabs.tab1', { 
     url: '/tab1', 
     onEnter: function() { console.log("enter tab1.html"); }, 
     controller: function($scope) { 

     }, 
     templateUrl: 'tab1.html' 
     }) 
     .state('tabs.tab2', { 
     url: '/tab2', 
     onEnter: function() { console.log("enter tab2"); }, 
     controller: function($scope) { 

     }, 
     templateUrl: 'tab2.html' 
     }); 
+0

我知道這是但是我注意到你的Plunker中仍然存在一個bug。當你打回來從'標籤2'瀏覽器選項卡中內容的變化箭頭'標籤1'但是'標籤2'仍處於選中狀態(下面有'標籤2'紅線內容時說:'標籤1')。這可以解決嗎? – Misiu

+0

請不要使用那個笨蛋了。它是用老版本的Angular Material製作的,需要解決方法才能與UI路由器配合使用。現在不是這樣了。 – LeoLozes

+0

你可以看到它做工精細沒有「跨度」黑客在這裏:http://plnkr.co/edit/psinbetM1CUBqIxuL1yq – LeoLozes