Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Responsive API (endsWith-)Error when Default Value is not provided #1233

@nickwinger

Description

@nickwinger

Bug Report

buildStyles(gapValue, parent) {
if (gapValue.endsWith(GRID_SPECIFIER)) { <--- error is here
gapValue = gapValue.slice(0, gapValue.indexOf(GRID_SPECIFIER));
// Add the margin to the host element
return buildGridMargin(gapValue, parent.directionality);
}
else {
return {};
}
}

What is the expected behavior?

Don't check gapValue.endsWith when it's undefined

What is the current behavior?

if you specifiy e.g.
fxLayout="row wrap" fxLayoutGap.gt-xs="20px"
but you don't provide the default (fxLayoutGap="something")
and you start with a smaller screen (below xs) then the layout engine is checking
for the gap value, but it is not there.
But there is no check for gapValue === undefined in buildStyles, therefore an error comes
that endsWith does not exist on undefined

What are the steps to reproduce?

Providing a StackBlitz (or similar) is the best way to get the team to see your issue.
it's simple to reproduce by sourself...

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

latest

Is there anything else we should know?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions