0

I am using angular 4 with its respective Material . My app.component.html looks like this :

<!--The whole content below can be removed with the new code.-->
<md-toolbar color="primary" >
    <button md-button (click)="sidenav.toggle()"><md-icon class="md-18|md-
24|md-36|md-48">menu</md-icon></button>
    <span>Material 2</span>
    <span class="example-spacer"></span>
</md-toolbar>


<md-sidenav-container layout="column" flex style="background: plum;">

    <md-sidenav #sidenav side="left" class="example-sidenav" flex layout="column" style="background: plum;">
    <md-list>
    <div class="row">
        <md-list-item><md-icon>explore</md-icon> <span>item</span></md-list-item>
    </div>

    <div class="row">
    <md-list-item><md-icon>map</md-icon> <span>item</span></md-list-item>
    </div>

    <div class="row">    
    <md-list-item><md-icon>home</md-icon> <span>item</span></md-list-item>
    </div>

    <div class="row">
    <md-list-item><md-icon>android</md-icon> <span>item</span></md-list-item>
    </div>

    <div class="row">
    <md-list-item><md-icon>done</md-icon> <span>item</span></md-list-item>
    </div>

    </md-list>
    </md-sidenav>


    <md-grid-list cols="4" rowHeight="100px" layout="column" flex>

    </md-grid-list>

</md-sidenav-container>
`

The divs expand vertically only till the point they have data defined.

How to make the md-sidenav-container take up all of the space left vertically?

Plunkr : https://plnkr.co/edit/Mvm6zSifW0EpeKtmuSEA?p=preview

Note: I don't want a CSS min-height, height: 100% fix. Only a clean class/directive based solution for Angular Material 2/4.

Aakash Uniyal
  • 1,519
  • 4
  • 17
  • 32

1 Answers1

3

Move your <md-toolbar> inside the container and add the fullscreen attribute to the <md-sidenav-container>:

<md-sidenav-container layout="column" flex style="background: plum;" fullscreen>
  <md-toolbar color="primary" >
      <button md-button (click)="sidenav.toggle()"><md-icon class="md-18|md-24|md-36|md-48">menu</md-icon></button>
      <span>Hems IRCA</span>
      <span class="example-spacer"></span>
  </md-toolbar>

...

See this answer for more details

Updated plunker

0mpurdy
  • 3,198
  • 1
  • 19
  • 28
  • Thanks for the answer , fullscreen attribute works well . But i also dont want toolbar to be hidden by the sidenav bar , previously the sidenav bar was below the toolbar . If there is any other way to leverage the fullscreen attribute without hindering the toolbar and sidenav bar structure as mentioned before – Aakash Uniyal Jul 25 '17 at 09:44
  • I'm not sure how you would do that but you could try the `mode="push"` attribute on the `` – 0mpurdy Jul 25 '17 at 10:01