angular-cdk

Angular 7 Drag and Drop - Dynamically Create Drop Zones

大城市里の小女人 提交于 2019-12-03 03:17:18
Is there a way to dynamically create drop zones? I'm having some troubles with ngFor and cdkDropList. Here is my first list and draggable elements: <div class="subj-container" cdkDropListOrientation="horizontal" cdkDropList #subjectList="cdkDropList" [cdkDropListData]="subjects" [cdkDropListConnectedTo]="[lessonList]" (cdkDropListDropped)="drop($event)" > <div class="subject" *ngFor="let subject of subjects" cdkDrag> {{subject.name}} </div> </div> And here is my second list: <div class="conta" cdkDropList #lessonList="cdkDropList" [cdkDropListData]="appointment.lessons" [cdkDropListConnectedTo

Nested Drag and Drop in with Angular 7 Material CDK

和自甴很熟 提交于 2019-12-01 10:34:38
I've got a nested tree (Not the tree component) of drag and drop lists. When dragging items around in drop lists that are contained inside of another drop list - Enter / Exit events are firing for both drop lists, meaning that when an item is dropped it could either be dropped into the inner drop list or the container drop list depending where it was dropped (Note: These lists are all linked to each other) I'm thinking at the moment that the best solution will to be suppress events firing for the container list if the drag is currently over an inner list but I'm not sure if this is the best

How to programmatically scroll to item with angular's material virtual scroll?

被刻印的时光 ゝ 提交于 2019-12-01 04:02:51
I have a list that has many items and each item can be selected. For this I use Angular Material Virtual Scroll. When an item is selected, the selected item is highlighted and then is saved on the server. When I refresh the page, the selected item comes from the server and is again highlighted. My code looks like <cdk-virtual-scroll-viewport itemSize="40" class="wrapper"> <div *cdkVirtualFor="let item of list" [class.selected]="item.id === selectedItem.id"> </div> </cdk-virtual-scroll-viewport> The problem is that if a select an item that is down in the list, it is highlighted, but I have to

mat-sort not working on mat-table

耗尽温柔 提交于 2019-12-01 03:10:41
My mat-table is working fine, but when adding mat-sort following the official api documentation, it fails at the ngAfterViewInit with the following message Cannot set property 'sort' of undefined at ViewFeedbackComponent.ngAfterViewInit There is already a SO post on this issue (see following link) Mat-table Sorting Demo not Working but I still am not able to get it working. Does somebody spot the issue? The official example works with a "static" MatTableDataSourcedefined in the component itself, I am querying from my back-end, however. Any help is greatly appreciated! MatSortModule is already

How to programmatically scroll to item with angular's material virtual scroll?

假装没事ソ 提交于 2019-12-01 01:37:19
问题 I have a list that has many items and each item can be selected. For this I use Angular Material Virtual Scroll. When an item is selected, the selected item is highlighted and then is saved on the server. When I refresh the page, the selected item comes from the server and is again highlighted. My code looks like <cdk-virtual-scroll-viewport itemSize="40" class="wrapper"> <div *cdkVirtualFor="let item of list" [class.selected]="item.id === selectedItem.id"> </div> </cdk-virtual-scroll

Cancel drag on key press Angular cdk Drag and Drop

人盡茶涼 提交于 2019-12-01 01:16:09
问题 I´m working in a application implementing the new drag and drop from angular material CDK and i´m trying to cancel the drag event of the element pressing Esc , i mean, i start dragging the element but if i press Esc while i´m dragging the element, it should go back to the position from where i start dragging it, so far i haven´t found a way to do this, does anyone know how can i do this. There nothing in the cdk documentation about this any idea. i try doing something like this. Template <div

How to subscribe to Observable of Component injected via @angular/cdk/portal?

馋奶兔 提交于 2019-11-30 17:55:10
问题 I'm trying to implement a basic (very basic) modal implementation. I've got a ModalService and a ModalComponent . The ModalService creates an instance of the ModalComponent and injects it into the page using the @angular/cdk/portal. I can get the modal to display just fine :-) The ModalComponent has an Observable property that I want the ModalService to subscribe to so that when the 'close' button is clicked within the modal, a value can be emitted and the ModalService can close the modal.

Angular-Material Sidenav cdkScrollable

拟墨画扇 提交于 2019-11-30 13:57:52
问题 The Angular Material CDK provides a Directive CdkScrollable , which allows you to listen to ScrollEvent s of a specific container. I am now trying to access the CdkScrollable of the MatSidenavContent , which is added by default. However my @ViewChild(CdkScrollable) and @ContentChild(CdkScrollable) are always undefined. My Component looks something like this: <mat-sidenav-container> <mat-sidenav>Sidenav content</mat-sidenav> <div>Main content</div> </mat-sidenav-container> The resulting DOM

Angular-Material Sidenav cdkScrollable

被刻印的时光 ゝ 提交于 2019-11-30 09:02:44
The Angular Material CDK provides a Directive CdkScrollable , which allows you to listen to ScrollEvent s of a specific container. I am now trying to access the CdkScrollable of the MatSidenavContent , which is added by default. However my @ViewChild(CdkScrollable) and @ContentChild(CdkScrollable) are always undefined. My Component looks something like this: <mat-sidenav-container> <mat-sidenav>Sidenav content</mat-sidenav> <div>Main content</div> </mat-sidenav-container> The resulting DOM looks something like this: <mat-sidenav-container> <div class="mat-drawer-backdrop"></div> <div tabindex=

Angular 6 MatTable Performance in 1000 rows.

与世无争的帅哥 提交于 2019-11-30 08:41:43
I'm using angular material in my project and I'm using Mat-Table to render 1000 Product/row per table. When Change pagination (we use backend pagination) of table to 1000 rows the performance become very slow I even can't write in textboxes. I tried to debug the issue so I put logs on one column template so I can see how's render works. I see it's Rerender all rows even if I hover on the table headers. Is there's any possibilities to control the change detection to be like ChangeDetectionStrategy.OnPush Not sure if this will help your situation as there's no code but we've found that the