Angular material docs updated,

+ @angular/material-moment-adapter added to package.json
This commit is contained in:
mustafahlvc
2017-11-17 18:35:43 +03:00
parent 142fc982ca
commit 76358f996e
112 changed files with 1697 additions and 1041 deletions

View File

@@ -0,0 +1 @@
/** No CSS for this example */

View File

@@ -0,0 +1,5 @@
<mat-form-field>
<input matInput [matDatepicker]="dp" placeholder="Verbose datepicker" [formControl]="date">
<mat-datepicker-toggle matSuffix [for]="dp"></mat-datepicker-toggle>
<mat-datepicker #dp></mat-datepicker>
</mat-form-field>

View File

@@ -0,0 +1,44 @@
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import * as moment from 'moment';
// See the Moment.js docs for the meaning of these formats:
// https://momentjs.com/docs/#/displaying/format/
export const MY_FORMATS = {
parse : {
dateInput: 'LL'
},
display: {
dateInput : 'LL',
monthYearLabel : 'MMM YYYY',
dateA11yLabel : 'LL',
monthYearA11yLabel: 'MMMM YYYY'
}
};
/** @title Datepicker with custom formats */
@Component({
selector : 'datepicker-formats-example',
templateUrl: 'datepicker-formats-example.html',
styleUrls : ['datepicker-formats-example.css'],
providers : [
// `MomentDateAdapter` can be automatically provided by importing `MomentDateModule` in your
// application's root module. We provide it at the component level here, due to limitations of
// our example generation script.
{provide : DateAdapter,
useClass: MomentDateAdapter,
deps : [MAT_DATE_LOCALE]
},
{provide : MAT_DATE_FORMATS,
useValue: MY_FORMATS
}
]
})
export class DatepickerFormatsExample
{
date = new FormControl(moment());
}