2

I have a view that slides into a div using angular. My problem is, the content is dynamic and the height of that view is going to change. How can I set the height of my outer div to fit the height of the inner div? Also, my inner div has to have position: absolute in order to use the css sliding class that slides the view into place.

Also worth mentioning that if I log:

console.log($("#item-container").height());

I get 163px which is the height of one category column in the row

Outer div

<div data-ng-app="items">
    <div ng-controller="ParentController">
        <div data-ng-view class="slide-left">

        </div>
    </div>
</div>

Inner div

<div class="container" id="item-container">
    <div data-ng-repeat="c in categories">
        <div ng-class="{true: 'row'}[$index % 3 == 2]">
            <div class="col-sm-4">
                <div class="row">
                    <label>{{c.Name}}</label>
                </div>
                <a class="row" href="#!/categories/{{c.CategoryID}}">
                    <img src="/images/thumb/NoImageAvailable.jpg" class="categoryBackground" />
                </a>
            </div>
        </div>
    </div>
</div>
Dominick Piganell
  • 704
  • 2
  • 10
  • 29
  • possible duplicate of [Dynamically changing height of div element based on content](http://stackoverflow.com/questions/614881/dynamically-changing-height-of-div-element-based-on-content) – TylerH May 05 '14 at 15:34
  • @TylerH I saw this questions and this does not answer my question – Dominick Piganell May 05 '14 at 18:39

1 Answers1

1

set

<div style="display:inline-block"></div> for all

else use css

div
{
    display:inline-block;    
}
Vivek MVK
  • 1,155
  • 10
  • 19