angular-material

Angular - Dynamic component in mat-tab

走远了吗. 提交于 2020-07-21 03:22:13
问题 I have a mat-tab-group (angular material) and I want to be able to add from code behind mat-tabs including other components. I am using ComponentFactoryResolver to create the component but I am not able to add the new component to the new mat-tab through the ViewContainerRef html <mat-tab-group> <mat-tab *ngFor="let tab of tabs" [label]="tab.title"> <div #test></div> </mat-tab> </mat-tab-group> code behind private open(type:string):void{ var tab = {title:'test'}; this.tabs.push(tab); const

Angular - Dynamic component in mat-tab

落爺英雄遲暮 提交于 2020-07-21 03:21:24
问题 I have a mat-tab-group (angular material) and I want to be able to add from code behind mat-tabs including other components. I am using ComponentFactoryResolver to create the component but I am not able to add the new component to the new mat-tab through the ViewContainerRef html <mat-tab-group> <mat-tab *ngFor="let tab of tabs" [label]="tab.title"> <div #test></div> </mat-tab> </mat-tab-group> code behind private open(type:string):void{ var tab = {title:'test'}; this.tabs.push(tab); const

Material Angular scroll to element on mat-list

扶醉桌前 提交于 2020-07-21 00:36:50
问题 I have an Angular Material list with multiple elements, where one of them can be selected. When I load this list I want to scroll list up to that selected element, to make it more visible. Is there any option? I was thinking about something like in ngOnInit to check if item is selected, but I have really no idea how to scroll this list up to that item. Note: not whole page should be scrolled, only the elements on the list. component.html <mat-nav-list> <mat-list-item *ngFor="let item of items

Material Angular scroll to element on mat-list

别说谁变了你拦得住时间么 提交于 2020-07-21 00:36:30
问题 I have an Angular Material list with multiple elements, where one of them can be selected. When I load this list I want to scroll list up to that selected element, to make it more visible. Is there any option? I was thinking about something like in ngOnInit to check if item is selected, but I have really no idea how to scroll this list up to that item. Note: not whole page should be scrolled, only the elements on the list. component.html <mat-nav-list> <mat-list-item *ngFor="let item of items

MatTabNavBar not showing arrows

余生颓废 提交于 2020-07-20 18:25:51
问题 I've noticed that the MatTabNavBar is behaving different from a regular MatTabGroup when it comes to showing the arrows if the container gets too small for the tabs. I used the official documentation to build the MatTabNavBar and MatTabGroup, but you can see here that the MatTabGroup is showing arrows and the MatTabNavBar is not. https://angular-gaio5u.stackblitz.io Template used for MatTabGroup: <mat-tab-group> <mat-tab *ngFor="let tab of tabs" [label]="tab.label" > {{ tab.label }} </mat-tab

Mat Sort Issue for Numbers and Text Columns

冷暖自知 提交于 2020-07-20 17:37:04
问题 I have angular material datasource. angular material version is ^5.0.3 Sorting is working. However for some columns it is sorting incorrectly. where number and text is there. For instance, sorted result like, 'XXX', '1', '1tesxt', '1', 'OPD', OXD', '12'. <mat-table #table [dataSource]="dataSource" matSort > <ng-container matColumnDef="model"> <mat-header-cell *matHeaderCellDef mat-sort-header> Model </mat-header-cell> <mat-cell *matCellDef="let element"> {{element.model}} </mat-cell> </ng

search input field in angular?

自作多情 提交于 2020-07-19 07:52:28
问题 Here I have folderObjs array and Console of this array is in below code, I put search input field and I want to make search for this array by folderName and folderSize in angular how it is possible? HTML <mat-form-field> <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Search"> </mat-form-field> <div *ngFor="let folder of folderObjs"> <span>{{folder.folderName}}</span> <span>{{folder.folderSize}}</span> </div> TS folderObjs : Folder[] = []; applyFilter(filterValue) {

How to add Icon inside the Angular material Snackbar in Angular 5

最后都变了- 提交于 2020-07-17 10:49:22
问题 I am new to angular and I am using Angular Material Design for UI. In my application I have a snackbar . Now I want to set an Icon inside the snackbar but I tried some Stackoverflow post I can't set it . code: this.snackBar.open('You are already registered.Please log in.','', { duration: 2000 }); I want to set the icon as in the image but I have the below snackbar without icon .I don't know how to add this . can anyone help me to add this. 回答1: This how I did it Create a component Create a

Angular Material: Popup Windows : Allow Windows to Go Between Front and Back

时间秒杀一切 提交于 2020-07-13 15:50:07
问题 We have 1) Material Dialog Component Opening up 2) Another Material Dialog Component, when user press "Open Adv. Search" Button. The first Dialog component is in fixed position. The second Dialog component is Movable, however cannot go behind first original one yet. How to make it so, users can interchange the back or front positions of both windows, like typical Windows 10 desktop app, depending on what is clicked/drag/drop last? Second Component: public openAdvancedPropertySearchDialog():

How to select the table row in angular based on the object?

纵饮孤独 提交于 2020-07-10 10:26:35
问题 Hello folks I have one scenario in which I am really confused on how to figure out...!! The scenario is I have 1)The mat table(that is the angular material table) 2)And a details view which shows the details based on the click of the particular row of the table. 3)list of objects as a data source..!! I pass the object on the click event of the row and the object passes to the detail view and the details of that particular row is shown now the question is....!! I have the same data source that