angular-material2

How to change angular material datepicker format

喜夏-厌秋 提交于 2020-05-06 15:32:10
问题 This is the format of date I am getting when I am using angular material datepicker.... Wed Nov 21 2018 00:00:00 GMT+0530 (India Standard Time) But I need date in (YYYY-MM-DD) or (YYYY-MM-DDTHH:mm) this format. this is model class I am using to capture data from angular material form export class FlightSchedule { constructor( public destination: string, public origin: string, public date: string, public limit: string ) {} } Please help me, I am unable to convert date in YYYY-MM-DD or YYYY-MM

Angular material , to select mat-list-option and show the respective data of the selected mat-list-option

戏子无情 提交于 2020-04-16 02:43:04
问题 When the user hovers over the first column of the table , a tooltip comes up which has a button at the bottom. On click of the button, angular mat-dialog opens up which has the first column data on the left hand side of the mat-dialog. I need to achieve 2 things 1) On the left hand side of mat-dialog, mat-list-option should be selected by default depending on whichever row user hovered upon and clicked on its tooltip button. 2) The right hand side of the mat-dialog needs to be populated with

Angular 5 material: dropdown (select) required validation is not working

我的梦境 提交于 2020-03-21 19:16:33
问题 I have a material dropdown inside my ngForm, when I set this select as required it shows an asterisk * beside it but the form is seen as valid if I don't select any option from the dropdown. <mat-form-field class="col-4 offset-1"> <mat-select placeholder="Some placeholder" [(value)]="data.name" required> <mat-option *ngFor="let name of names" [value]="name.value"> name.viewValue </mat-option> </mat-select> </mat-form-field> This is unlike what happens if I set the material input to required

Angular 5 material: dropdown (select) required validation is not working

你说的曾经没有我的故事 提交于 2020-03-21 19:14:50
问题 I have a material dropdown inside my ngForm, when I set this select as required it shows an asterisk * beside it but the form is seen as valid if I don't select any option from the dropdown. <mat-form-field class="col-4 offset-1"> <mat-select placeholder="Some placeholder" [(value)]="data.name" required> <mat-option *ngFor="let name of names" [value]="name.value"> name.viewValue </mat-option> </mat-select> </mat-form-field> This is unlike what happens if I set the material input to required

Material Dialog Close on mouseleave (angular material)

旧街凉风 提交于 2020-03-05 06:21:31
问题 I created a dialog using Angular Material https://material.angular.io/components/dialog/overview I open it here <td *ngFor="let item of items; let i = index" on-mouseover='openDialog(item)' on-mouseleave='closeDialog()' > Where in component I have definition of those functions: openDialog(item:Item) { this.dialog.open(ItemDialog,{ data: { someData: item.data }) } And closeDialog(){ console.log("close"); this.dialog.closeAll; } This is my dialog definition: @Component({ selector: 'item-dialog'

MatCheckbox preventDefault() and event.checked value

若如初见. 提交于 2020-03-02 09:16:30
问题 How can I achieve a Material checkbox so It won't get checked/unchecked by default (eg. calling preventDefault() on the event) and also get the checked value from the event? It seems like I can only achieve one of the conditions. Using the (click) event I cannot get the checkbox's value and using the (change) event I can't prevent the default checkbox value change (I will only change the checkbox value if the underlying HTTP request was successful). Stackblitz: https://stackblitz.com/edit

Angular Material 2 container

天大地大妈咪最大 提交于 2020-02-24 12:41:48
问题 I'm new to Angular material 2 and I'm accustomed to using bootstrap 4.1. So this question may seem simple, but how does one create a "container" in Angular material 2? For example in a bootstrap container in will create a left and right margin for the entire app, can this be achieved easily with Angular material 2? 回答1: Well it all depends on your layout. If you have all your content in one card, you don't need to mind about anything, the card will be nicely displayed thanks to its set width.

Angular Material 2 container

不问归期 提交于 2020-02-24 12:40:50
问题 I'm new to Angular material 2 and I'm accustomed to using bootstrap 4.1. So this question may seem simple, but how does one create a "container" in Angular material 2? For example in a bootstrap container in will create a left and right margin for the entire app, can this be achieved easily with Angular material 2? 回答1: Well it all depends on your layout. If you have all your content in one card, you don't need to mind about anything, the card will be nicely displayed thanks to its set width.

Angular material 2 table - define column using TemplateRef and ngTemplateOutlet

谁说我不能喝 提交于 2020-02-23 11:53:51
问题 I am trying to make reusable material table and I want to use TemplateRef with ngTemplateOutlet to generate columns. In this example I created cards components which is using my material-table component. In cards.component.html I have template of one of my table's column. Running the project will cause an error ERROR TypeError: Cannot read property 'template' of undefined (see console on stackblitz ). Is it possible to pass columnt template to my MaterialTableComponent and use it to define

Angular material 2 table - define column using TemplateRef and ngTemplateOutlet

房东的猫 提交于 2020-02-23 11:53:49
问题 I am trying to make reusable material table and I want to use TemplateRef with ngTemplateOutlet to generate columns. In this example I created cards components which is using my material-table component. In cards.component.html I have template of one of my table's column. Running the project will cause an error ERROR TypeError: Cannot read property 'template' of undefined (see console on stackblitz ). Is it possible to pass columnt template to my MaterialTableComponent and use it to define