material icon indicating copy to clipboard operation
material copied to clipboard

mdContent: don't get 100% of height

Open aderbas opened this issue 11 years ago • 10 comments

I have a problem at the height of the md-content. My app has ng-view and it is 100% of the page, but the md-content don't get 100% of parent. Look that result:

<ng-view flex class="md-padding">
     <md-content flex> foo </md-content>
</ng-view>

I try put style="height: 100%" but not work.

problem-md-height

I've tried the issues but found that solved my problem.

aderbas avatar Jun 10 '15 15:06 aderbas

try this, and i think you using ng-view wrong

<ng-view layout="column">
     <md-content flex layout-padding> foo </md-content>
</ng-view>

i use something like this:

<div layout="column">
     <md-content flex layout-padding layout="row">
          <div ng-view flex></div>
     </md-content>
</div>

cebor avatar Jun 10 '15 19:06 cebor

I'm using this in index.html

<body layout="column" ng-controller="IndexController">
    <div layout="row" flex> 
        <md-sidenav>...</md-sidenav>
        <ng-view flex class="md-padding"></ng-view>
    </div>
</body>

I'm using ngRouter and my "main.html" like this:

<md-content flex> foo </md-content>

I think it was not so clear before, sorry

aderbas avatar Jun 10 '15 19:06 aderbas

Please provide a CodePen or Plunkr that demonstrates this issue.

  • CodePen template: http://codepen.io/team/AngularMaterial/pen/BNYppz
  • Plunkr template: http://plnkr.co/edit/yP0gB9iTacIQb48thud8?p=preview.

ThomasBurleson avatar Sep 04 '15 12:09 ThomasBurleson

@aderbas - you must specify the height of the mdContent:

layouts with ng-view

Demo and Source: http://codepen.io/team/AngularMaterial/pen/BNYppz

ThomasBurleson avatar Sep 08 '15 01:09 ThomasBurleson

Someone set the angular-material links/scripts to be fetched from localhost:8080/*, rendering the demo non-functioning. You have to lookup for a CDN for both CSS and JS of angular-material to make the demo work again.

akomm avatar Nov 17 '15 15:11 akomm

Test this trick :

        <div layout="row">
            <div layout="column">
                <div flex> Content1 </div>
                <div flex> Content2 </div>
            </div>
        </div>

Mg-Yaya avatar Dec 05 '15 11:12 Mg-Yaya

@akomm - Fixed:

screen shot 2015-12-05 at 10 21 37 am

CodePen Demo


@Mg-Yaya - Your sample has several issues that you must address:

  • You must include 'ngMaterial' as a module dependency
  • You must set the height of the outer-most layout
  • You must flex the nest layout

screen shot 2015-12-05 at 9 33 58 am

CodePen Demo

ThomasBurleson avatar Dec 05 '15 15:12 ThomasBurleson

Here is the Layout Collection @ our Angular Material CodePen Community

ThomasBurleson avatar Dec 05 '15 16:12 ThomasBurleson

@ThomasBurleson - I want to make tabs and a menu side by side, is it possible without using position proprety in css. sc1

Mg-Yaya avatar Dec 06 '15 11:12 Mg-Yaya

Solution: You're using Angular-material, all you have to do is adding the layout-fill attribute to all parents of the elements you want to fill vertically, starting from .

foo

jfyi: ng-view will in henrit the the full height of your page's body.

guillaume250 avatar Mar 28 '17 03:03 guillaume250