Reputation: 6988
I have a couple views and I'm looking to adjust the container width based on the view I'm in.
<!-- 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>
When I hardcode the ng-style width property it works. Above I hardcode it to 95%. However, when I set it to a scope variable and set that variable inside the view's controller it doesn't work.
<div class="container" ng-style="{ 'width': containerWidth }">
Inside one of the view controllers:
$scope.containerWidth = '95';
Upvotes: 0
Views: 33
Reputation: 222532
It should be,
<div class="container" ng-style="{ 'width': containerWidth + 'px' }">
Upvotes: 1