0
我有幾個觀點,我期待基於我在視圖調整容器寬度。NG-風格不採取範圍值
<!-- our main container area for the views -->
<div class="container" ng-style="{ 'width': '95%' }">
<div class="row" style="height: 100%;">
<!-- below is where the partial pages will replace -->
<div style="height: 100%;" ng-view></div>
</div>
</div>
當我硬編碼NG式width屬性有用。以上我硬編碼到95%。但是,當我將它設置爲一個範圍變量並在視圖的控制器中設置該變量時,它不起作用。
<div class="container" ng-style="{ 'width': containerWidth }">
裏面的視圖控制器之一:
$scope.containerWidth = '95';
我用%,但我試過+ '%' 和它doesn」不管工作。 – user441521
這是因爲容器比視圖/控制器更高級別,因此範圍變量? – user441521
@ user441521在這裏檢查https://jsfiddle.net/3mhxxq13/ – Sajeetharan