Is there a way to adjust the height of mat-sidenav-content to be 100%?

I'm having trouble scrolling down my mat-sidenav-content to reach the bottom where my pagination is located. When I try using fullscreen on mat-sidenav-container, my mat-toolbar disappears. How can I adjust my mat-sidenav-content based on the content? Check out the image below:

https://i.stack.imgur.com/w8KkX.jpg

author.component.html

<mat-sidenav-container class="example-container">
  <mat-sidenav mode="side" opened>
      <mat-list class="mt-5">
          <mat-list-item><mat-icon class="me-2">book</mat-icon><a routerLink="/book">Book</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">supervisor_account</mat-icon><a routerLink="/author">Author</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">local_offer</mat-icon><a routerLink="/category">Category</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">folder_shared</mat-icon><a routerLink="/publisher">Publisher</a></mat-list-item>
      </mat-list>
  </mat-sidenav>

  <!-- Main Content -->
  <mat-sidenav-content id="content">
    <mat-card class="header mat-elevation-z5">
      <mat-card-title class="mt-2">Author</mat-card-title>
      <button mat-raised-button color="warn" class="add-button" (click)="openAddModal()">Add new</button>
    </mat-card>
    
    <br>
    
    <div class="example-container float-end">
      <mat-form-field class="example-full-width" appearance="fill">
        <mat-label>Filter</mat-label>
        <input matInput placeholder="Search...">
      </mat-form-field>
    </div>

    <br>
    
    <table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
        <!-- Price Column -->
        <ng-container matColumnDef="authorname">
          <th mat-header-cell *matHeaderCellDef> Author </th>
          <td mat-cell *matCellDef="let element"> {{element.authorname}} </td>
        </ng-container>
    
        <ng-container matColumnDef="actions">
            <th mat-header-cell *matHeaderCellDef> Actions </th>
            <td mat-cell *matCellDef="let element">
              <button mat-raised-button color="primary" (click)="updateClick()">Edit</button>
            </td>
        </ng-container>
      
        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
    </table>

    <mat-paginator class="mat-elevation-z5" [pageSize]="10" 
      [pageSizeOptions]="[10, 25, 50, 75, 100]" 
      showFirstLastButtons 
      aria-label="Select page">
    </mat-paginator>

  </mat-sidenav-content>
</mat-sidenav-container>

author.component.css

#content {
    width: 82%;
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s;
    background: rgb(240, 237, 237);
}
mat-sidenav-container {
    height: 100%;
}
mat-sidenav {
    width: 18%;
    background-color: #fff;
}
mat-list-item a {
    text-decoration: none;
    color: #000;
}

Answer №1

If you want to enhance the appearance of your table, consider using the following CSS code:

overflow: auto;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combine form data from a reactive form into a string using interpolation

Currently, I am working with an object that has a string property embedded within it. The string in this property contains interpolation elements. For my user interface, I have implemented a reactive form with an input field. My goal is to display the ent ...

Issue with form using "target=_blank" to open PDF in web application home screen not functioning properly

I am encountering an issue in my Angular application where a form with target="_blank" successfully returns a PDF upon submission, but when accessed from the homescreen icon of the web-app in Android/Chrome, the new window opens blank without displaying th ...

Tips for assigning an external variable using Angular RxJS map function?

I am currently working on making code more reactive and declarative by using the async pipe to update the template. I'm facing a challenge with changing a variable that was previously set in the subscribe() method. Updating this variable from the map ...

Issue encountered with Angular Material's md-chips and md-autocomplete: The error message "control.registerOnChange is not a

When attempting to wrap mat-chips and mat-autocomplete into a ControlValueAccessor, I encountered the following errors: InfoEditorComponent.html:17 ERROR TypeError: control.registerOnChange is not a function at setUpModelChangePipeline (forms.js:2701) ...

Steps for associating ngclass with an observant value

Can you bind to an Observable<enum> like this in Angular? <a [ngClass]="{selected: (mapToolBarMode$ | async) === 0 }" /> or <a [ngClass]="{selected: (mapToolBarMode$ | async) === MapMode.Pan }" /> where the observable is named mapTool ...

Develop a custom cell editor for ag-Grid and insert it into a designated location within

I am currently working with Angular 16 and AgGrid 30. My goal is to have the cell editor created in a different location than its default position, which is within a div element at the bottom of the body with these classes: ag-theme-material ag-popup. I w ...

Ensuring the Current Page is Valid Before Progressing to the Next Step in Angular-Archwizard

Currently, I am working with Angular-7 and using angular-archwizard to create a multi-step form. The issue I am facing is that the form allows users to proceed to the next step without filling in all the required fields. My goal is to restrict users from m ...

Problem with updating Cypress e2e tests following recent package upgrades

My current project involved updating all the packages to their latest versions. Prior to the update, all end-to-end tests were functioning correctly without any issues. After completing the update, the product itself compiles and runs as expected without ...

AngularJS: Integrating OAuth2 for RESTful API Development

I am currently working on incorporating OAuth2 authentication into my Angular 2 web project, which relies heavily on REST APIs. I have come across several ng-oauth2 packages that require a new login page for authentication, but I am in need of a restful au ...

There is no 'next' property available

export function handleFiles(){ let files = retrieveFiles(); files.next(); } export function* retrieveFiles(){ for(var i=0;i<10;i++){ yield i; } } while experimenting with generators in T ...

Should we be worried about the security of the RxJS library?

Currently, I am in the midst of a project utilizing RxJS within the Angular framework. A recent security evaluation flagged the use of window.postMessage(‘’, ‘*’) in our application as a potential vulnerability. Further investigation pinpointed Imm ...

Tips for accessing the FormControlName of the field that has been modified in Angular reactive forms

My reactive form consists of more than 10 form controls and I currently have a subscription set up on the valueChanges observable to detect any changes. While this solution works well, the output always includes the entire form value object, which includ ...

What causes the presence of undefined elements within the ngOnInit function of Angular?

When I initialize a library in my ngOnInit method like this: ngOnInit() { this.$grid = jQuery('.grid').masonry({ // options itemSelector: '.grid-item',//, columnWidth: 384, gutter: 24 }); ...... } and then call the method from ...

Creating a custom Angular 5 package integrated with external JavaScript libraries

I have developed a custom wrapper for a JavaScript library and I want to distribute it via npm. For this purpose, I am utilizing SystemJS and scriptloader to load the JavaScript library. The setup is working correctly and I am able to successfully build ...

Adding an external JavaScript library file to a specific component in Angular 7 is a straightforward process. Let's walk through the

As a beginner in Angular framework, I've encountered an issue while working on creating a custom HTML template using Angular version 7. My template consists of various pages like home, about, product, etc. Specifically, on the home page, I am trying t ...

Issue with setting cookie: Browser does not retain cookie after receiving successful response

I am currently working on a project that involves Angular and NestJS, but I have encountered an issue with managing cookies. After logging in through the Angular frontend, the server responds with a Set-Cookie header containing the JWT token. However, for ...

How to retrieve the current route name or URL in AngularDart5

Exploring the OnActivate feature in Angular docs, I am attempting to utilize it to dynamically update the UI based on the current route. @Component( selector: "blah", template: """blah""", directives: const [routerDirectives]) class Blah ext ...

Easy Steps to Simplify Your Code for Variable Management

I currently have 6 tabs, each with their own object. Data is being received from the server and filtered based on the tab name. var a = {} // First Tab Object var b = {} // Second Tab Object var c = {} // Third Tab Object var d = {}// Fou ...

Angular StrictNullChecks: "Error - object may be null"

I am encountering an issue with the 'strictNullChecks' setting in my Angular project. This has resulted in numerous errors across my templates (.html), such as: <input #inputValue type="text" (keyup.ent ...

Managing state within SolidJS components using Immer's "produce" for nested state handling

I've been working on a SolidJS application where I store a large JSON object with nested objects. For undo and redo actions, I'm using Immer to generate patches. Although technically I'm storing a class with multiple layers of nesting, Immer ...