angular-material

Mat-Nav-List horizontal instead of vertical?

僤鯓⒐⒋嵵緔 提交于 2020-03-17 08:43:17
问题 How do I make the following horizontal instead of the (apparent default) of vertical? It is located within navigation.component.html within my Angular 5.2.7 application that was generated via Angular-CLI 1.7.2. The documentation link included in the comment does not discuss how to layout a Material navigation bar horizontally. <mat-nav-list> <!--https://material.angular.io/components/list/overview--> <mat-list-item> <a [routerLink]="['/home']">Home</a> </mat-list-item> <mat-list-item> <a

Mat-Nav-List horizontal instead of vertical?

断了今生、忘了曾经 提交于 2020-03-17 08:43:09
问题 How do I make the following horizontal instead of the (apparent default) of vertical? It is located within navigation.component.html within my Angular 5.2.7 application that was generated via Angular-CLI 1.7.2. The documentation link included in the comment does not discuss how to layout a Material navigation bar horizontally. <mat-nav-list> <!--https://material.angular.io/components/list/overview--> <mat-list-item> <a [routerLink]="['/home']">Home</a> </mat-list-item> <mat-list-item> <a

@angular/material/index.d.ts' is not a module

余生颓废 提交于 2020-03-11 12:53:19
问题 With Angular 8, While building the app, we encounter the following error: app/modules/admin-module/pages/editor/editor.component.ts:6:27 - error TS2306: File ...node_modules/@angular/material/index.d.ts' is not a module. 回答1: After upgrading to Angular 9 (released today), I ran into this issue as well and found that they made the breaking change mentioned in the answer. I can't find a reason for why they made this change. I have a material.module.ts file that I import / export all the

How to add custom validator to a FormArray?

喜夏-厌秋 提交于 2020-03-05 02:59:40
问题 I want to add custom validator to form in order to prevent mat-step switching to next step. All works well when I use FormGroups but I fail to achieve validation when I have to use FormArray. I've tried at least two variants of assigning validator on form initialization: inside array statuses: this._formBuilder.array([this.createStatus()], defaultStatusValidator()) inside parent form of array this.productionLineStatuses = this._formBuilder.group({statuses: this._formBuilder.array([this

How to add custom validator to a FormArray?

谁说我不能喝 提交于 2020-03-05 02:57:47
问题 I want to add custom validator to form in order to prevent mat-step switching to next step. All works well when I use FormGroups but I fail to achieve validation when I have to use FormArray. I've tried at least two variants of assigning validator on form initialization: inside array statuses: this._formBuilder.array([this.createStatus()], defaultStatusValidator()) inside parent form of array this.productionLineStatuses = this._formBuilder.group({statuses: this._formBuilder.array([this

Build errors after Upgrading from Angular 8 to 9

こ雲淡風輕ζ 提交于 2020-03-04 21:34:06
问题 I have an Angular application that is hosted in a .net core 3.1 application. I upgraded from 8 to 9 following the official guide and now my application won't build. I get the following errors: "Module not found: Error: Can't resolve '@angular/cdk/layout/breakpoints'", "Field 'browser' doesn't contain a valid alias configuration resolve as module looking for modules in No description file found Field 'browser' doesn't contain a valid alias configuration No description file found no extension

dynamically insert mat-checkbox

家住魔仙堡 提交于 2020-03-04 11:29:15
问题 I want to dynamically insert a <mat-checkbox> element into a component. and I inserted two <mat-checkbox> elements. one inserted statically (i.e into the template file directly). and the other one inserted dynamically, and contains a <mat-checkbox> and another normal checkbox <input type="checkbox" /> the first one (the statically inserted one) rendered without any problem. also the normal input inserted dynamically without any problem. but the <mat-checkbox> that dynamically inserted didn't

How to send return value to CanDeactivate Guard after close the mat-dialog | Angular CanDeactivate Guard | Angular Material Dialog

可紊 提交于 2020-03-03 11:45:11
问题 I'm using CanDeactivate Guard for find out the unsaved changes and If changes occurred I am showing the confirm material dialog, before leaving the page. Based on the dialog action I will return the Boolean value. CanDeactivateGuard.ts: export class DeactivateGuard implements CanDeactivate<UnsavedChangesComponent> { canDeactivate( component: UnsavedChangesComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): boolean | Observable

How to send return value to CanDeactivate Guard after close the mat-dialog | Angular CanDeactivate Guard | Angular Material Dialog

你离开我真会死。 提交于 2020-03-03 11:45:09
问题 I'm using CanDeactivate Guard for find out the unsaved changes and If changes occurred I am showing the confirm material dialog, before leaving the page. Based on the dialog action I will return the Boolean value. CanDeactivateGuard.ts: export class DeactivateGuard implements CanDeactivate<UnsavedChangesComponent> { canDeactivate( component: UnsavedChangesComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): boolean | Observable

mat-checkbox does not check if condition is false (only on double click)

那年仲夏 提交于 2020-03-03 10:48:50
问题 I have an entity that has a variable that needs to be the opposite of the checkbox state. enitity.enabled = true The checkbox is there to "mark to delete" the item. If you mark and send the form, the item marked is soft deleted. With this in mind, the checkbox is exactly like this: <mat-checkbox [(ngModel)]="!entity.enabled">{{!entity.enabled}}</mat-checkbox> For some reason, the enitity.enabled value is only changed when the second click applies. I looked a lot for a solution or if this is a