2016-08-22 67 views
0

使用角度材質標籤的Im。問題是標籤不是相同的大小。取決於內容。所以我想知道是否可以讓ng-scope成爲ng-scope的大小。風格的內部div

這是所得到的md-tab-content

<md-tab-content id="tab-content-3" class="_md ng-scope md-active"> 
    <div class="ng-scope ng-isolate-scope"> 
    </div> 
</md-tab-content> 

事情一個簡化版本我可以引用的角元素?而這樣做

md-tab-content > div.ng-scope { 
    and set size here = outside size? 

    //worst case set the height by hand 
    height: 252px; 
} 

這裏內div高度爲57時outter md-tab-content爲252

enter image description here

標籤代碼

<div id="tree-footer-container" ng-cloak> 
    <md-tabs id="jc" md-selected="selectedIndex"> 
     <md-tab class="fullSize" ng-repeat="tab in tabs" ng-disabled="tab.disabled"> 
      <md-tab-label> 
        <div style="float: left;padding-right: 10px;">{{tab.title}}</div> 
      </md-tab-label> 
      <md-tab-body> 
       <div flex style="background:blue" class="demo-tab tab{{$index%4}}" ng-include="tab.url"> 
       </div> 
      </md-tab-body> 
     </md-tab> 
    </md-tabs> 
</div> 

回答

0

嘗試使用材料的佈局指令:

<md-tab-content id="..." layout="column" class="..."> 
    <div flex class="..."> 
    </div> 
</md-tab-content> 
+0

這些是自動生成的。我沒有創建任何這些,你的答案仍然相關?因爲我需要更多細節。 –

+0

可能是。嘗試一下。 – Malk

+0

如何?再次自動生成。我只能嘗試創建一個CSS來改變生成的元素 –

0

我不知道所有的類,但我認爲這將與jQuery修復:

var newWidth = $('.ng-isolate-scope').outerWidth; 
$('.classOfOtherDiv').width(newWidth); 

首先你會得到一個div的外寬,然後將其應用到其他。那工作?

+0

這可以工作,但是如果我把這些代碼放在哪裏,所以如果事情發生變化就會刷新?這就是爲什麼我在考慮CSS。 –

+0

10你可以把它放在一個函數然後調用調整大小/加載/就緒函數。調整大小: '$(窗口).resize(函數(){resizeWidthFuntion()});' –

+0

看來你一定已經解決了這個問題,你可以標記它回答? –