mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-12-22 01:47:08 +00:00
Update Angular, Angular Material and Flex Layout to 6
Updated additional project files Updated Angular Material examples
This commit is contained in:
0
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.css
Normal file → Executable file
0
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.css
Normal file → Executable file
6
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.html
Normal file → Executable file
6
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.html
Normal file → Executable file
@@ -1,5 +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>
|
||||
<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>
|
||||
|
||||
67
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.ts
Normal file → Executable file
67
src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.ts
Normal file → Executable file
@@ -1,44 +1,47 @@
|
||||
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 {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';
|
||||
// Depending on whether rollup is used, moment needs to be imported differently.
|
||||
// Since Moment.js doesn't have a default export, we normally need to import using the `* as`
|
||||
// syntax. However, rollup creates a synthetic default module and we thus need to import it using
|
||||
// the `default as` syntax.
|
||||
import * as _moment from 'moment';
|
||||
// tslint:disable-next-line:no-duplicate-imports
|
||||
// import {default as _rollupMoment} from 'moment';
|
||||
|
||||
// const moment = _rollupMoment || _moment;
|
||||
const moment = _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'
|
||||
}
|
||||
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]
|
||||
},
|
||||
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
|
||||
}
|
||||
]
|
||||
{provide: MAT_DATE_FORMATS, useValue: MY_FORMATS},
|
||||
],
|
||||
})
|
||||
export class DatepickerFormatsExample
|
||||
{
|
||||
date = new FormControl(moment());
|
||||
export class DatepickerFormatsExample {
|
||||
date = new FormControl(moment());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user