Skip to content

Event is not assignable to parameter of type ResizedEvent #98

@vpeacock

Description

@vpeacock
<mat-sidenav-content [ngStyle]="{'margin-left.px': contentMargin}">
        <div class="content mat-elevation-z8"  (resized)="onResized($event)">
            <!-- Main content here! -->
            <router-outlet></router-outlet>
        </div>
        <app-scroll-top></app-scroll-top>
    </mat-sidenav-content>

When using this directive in my code, I get the following error:

(parameter) $event: Event Argument of type 'Event' is not assignable to parameter of type 'ResizedEvent'. Type 'Event' is missing the following properties from type 'ResizedEvent': newRect, isFirstngtsc(2345) sidenav.component.ts(15, 24): Error occurs in the template of component SideNavComponent.

This is my method:

public onResized(event: ResizedEvent): void { this.width = Math.round(event.newRect.width); this.height = Math.round(event.newRect.height); console.log(width${this.width}, height${this.height}); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions