angular-material-6

Theming in Angular 6 (and 7) for Mat-button-toggle

穿精又带淫゛_ 提交于 2019-12-11 13:01:32
问题 I found the wonderful link how to customize the Material toggle button. I succeed to set the background-color and the font-weight the way I want with @import '~@angular/material/theming'; @include mat-core(); $app-primary: mat-palette($mat-indigo); $app-accent: mat-palette($mat-pink, A200, A100, A400); $app-theme: mat-light-theme($app-primary, $app-accent); @mixin mix-app-theme($app-theme) { $primary: map-get($app-theme, primary); $accent: map-get($app-theme, accent); .mat-button-toggle

How to reduce the size of MatSelect DropDown Panel

萝らか妹 提交于 2019-12-11 02:42:25
问题 I am trying to reduce the default size of mat-select drop-down panel, But unable to figure out how to do it I have tried giving width , have tried overriding panel class in angular mat-select, But the size doesn't seem to go down My Template File <div class="col-md-8"> <mat-form-field style="float: right"> <mat-select panelclass="my-panel" placeholder="Select Course"(selectionChange)="selectCourse($event,courses)" disableOptionCentering> <mat-option *ngFor="let course of courses" [value]=

angular material stepper add new step items dynamically on every click

北慕城南 提交于 2019-12-06 05:46:53
问题 I am using angular material in my project. I want to add extra stepper item(mat-step) on every click of addItem button. I created a plunker here. https://stackblitz.com/edit/angular-enmq1z?file=app%2Fstepper-overview-example.ts Can anyone help me with this? Thanks in advance. 回答1: I would use FormArray along with FormGroup HTML: <button mat-raised-button (click)="addItem()"> add item </button> <form [formGroup]="formGroup"> <mat-horizontal-stepper formArrayName="form"> <mat-step

How to save selected object using mat-chip and autocomplete in angular material 2

血红的双手。 提交于 2019-12-05 14:12:35
I am using Angular 6 with Angular Material. I am trying to save a selected object or list of selected object from mat-chip and autocomplete. I am able to send string value to fruits[] array but can not able to send selected object in to fruits[] array. Please help me to find a solution. Thanks. My Demo Project Link: demo code on stackblitz You can try this solution. I have created a demo on Stackblitz . component.html <mat-form-field class="example-chip-list"> <mat-chip-list #chipList> <mat-chip *ngFor="let fruit of fruits;let indx=index;" [selectable]="selectable" [removable]="removable"

Why mat-error not get displayed inside mat-form field in angular material 6 withcustom global validators

有些话、适合烂在心里 提交于 2019-12-05 03:58:55
i am using angular material 6 ,i have a vaidation inside mat-form-field mat-error is not displayed , when move after mat-form-field to the mat-error which is displaying properly. Not Working code: <mat-form-field> <input matInput type="time" formControlName="ToTime"/> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error> </mat-form-field> Working Fine: <input matInput type="time" formControlName="ToTime"/> </mat-form-field> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be

Mat-select panel min-width

删除回忆录丶 提交于 2019-12-05 02:19:07
问题 I'm trying to customize mat-select with multiple checkboxes. for some reason the panel get wrong min-width as below: and I don't know where its calculating this min-width. also I tried to add panelClass and override the min-width from this class, for example: <mat-select #multipleSelect (selectionChange)="selectItem($event.value)" panelClass="multiple-panel" multiple> &.multiple-panel { min-width: 200px !important; } but when opening the dropdown its open with the original width (like in the

Cannot read property 'ngMetadataName' of undefined

依然范特西╮ 提交于 2019-12-05 00:38:29
I am using Angular 6 with Angular Material. After updating to the latest version, the console is throwing this error in development. On Production it is working Cannot read property 'ngMetadataName' of undefined It occurs when I am trying to open material dialog via a service ( without a service they are working fine). I think it is related to the Injectables, but I am not sure. Versions: cli: 6.1.5 , core: 6.1.4, material: 6.4.6 Here is the log stack: CustomDialogComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'ngMetadataName' of undefined at injectArgs (core.js:1418

angular material stepper add new step items dynamically on every click

淺唱寂寞╮ 提交于 2019-12-04 10:03:26
I am using angular material in my project. I want to add extra stepper item(mat-step) on every click of addItem button. I created a plunker here. https://stackblitz.com/edit/angular-enmq1z?file=app%2Fstepper-overview-example.ts Can anyone help me with this? Thanks in advance. I would use FormArray along with FormGroup HTML: <button mat-raised-button (click)="addItem()"> add item </button> <form [formGroup]="formGroup"> <mat-horizontal-stepper formArrayName="form"> <mat-step [formGroupName]="i" *ngFor="let customerGroup of formGroup.controls.form.controls; let i = index"> <ng-template

Mat-select panel min-width

心已入冬 提交于 2019-12-03 20:43:19
I'm trying to customize mat-select with multiple checkboxes. for some reason the panel get wrong min-width as below: and I don't know where its calculating this min-width. also I tried to add panelClass and override the min-width from this class, for example: <mat-select #multipleSelect (selectionChange)="selectItem($event.value)" panelClass="multiple-panel" multiple> &.multiple-panel { min-width: 200px !important; } but when opening the dropdown its open with the original width (like in the pic) and after few millisecond"jump" to the custom min-width defined on the panel class. I find the mat

MatTable Expand Collapse Icon issue on pagination and sort

只愿长相守 提交于 2019-11-30 09:14:53
问题 I've a angular material table which uses detailRow directive to insert a detail/sibling adjacent row to a table row. StackBlitz I wanted to give it an appearance of as if the row is being expanded or collapsed, so I added couple of icons to it which are toggled on the click of cell containing them. <mat-header-cell *matHeaderCellDef> Action </mat-header-cell> <mat-cell *matCellDef="let element"> <button mat-icon-button color="primary" (click)="element[i] = !element[i]"> <mat-icon id="expand