How to assign value to the Angular Material Constants like SELECT_PANEL_MAX_HEIGHT Which are provided in the official angular Material Documentation here
Asked
Active
Viewed 2,357 times
3 Answers
4
Constants such as SELECT_PANEL_MAX_HEIGHT is read only. You can only override options which have a special Injection token. For example: MAT_TOOLTIP_DEFAULT_OPTIONS for Material tooltip.
import { MAT_TOOLTIP_DEFAULT_OPTIONS } from "@angular/material";
...
providers: [
{
provide: MAT_TOOLTIP_DEFAULT_OPTIONS,
useValue: {
showDelay: 500,
hideDelay: 300
}
}
]

Eduard Kolosovskyi
- 1,396
- 12
- 18
-
1@masu9 if an injection token is provided you can use it to override the default behavior or values. [Tooltip Constants](https://material.angular.io/components/tooltip/api#constants) – webpreneur May 30 '19 at 09:05
-
Is there any way to change the value of a constant to modify the behavior of a component? For example, the animation speed of the expansion panel – Andres Gardiol Dec 12 '19 at 14:46
-
@AndresGardiol take a look at this example https://stackblitz.com/edit/angular-aubesd and try to change EXPANSION_PANEL_ANIMATION_TIMING constant – Eduard Kolosovskyi Dec 13 '19 at 09:35
1
Another option to make the select panel bigger or smaller:
::ng-deep .mat-select-panel {
max-height: 80vh !important;
}

Amos
- 91
- 3
1
see https://github.com/angular/components/issues/11780, the following worked for me:
.mat-select-panel {
max-height: 300px!important;
}

bfredo123
- 462
- 1
- 8
- 20