docs(datepicker): Add example for setLocale method (#6224)

* docs(datepicker): Add example for setLocale method

Add a usage example to show how the formatting locale of the datepicker can be be changed as that wasn't documented before.

* docs(datepicker): Wording change for setLocale example
This commit is contained in:
Sargo Darya
2017-08-02 23:34:04 +02:00
committed by tinayuangao
parent f19d2e52ee
commit fa3cf12aa8
+16
View File
@@ -128,6 +128,22 @@ By default the datepicker will use the locale code from the `LOCALE_ID` injectio
export class MyApp {}
```
It's also possible to set the locale at runtime using the `setLocale` method of the `DateAdapter`.
```ts
import { DateAdapter, NativeDateAdapter } from '@angular/material';
@Component({
selector: 'foo',
template: ''
})
export class FooComponent {
constructor(dateAdapter: DateAdapter<NativeDateAdapter>) {
dateAdapter.setLocale('de-DE');
}
}
```
#### Choosing a date implementation and date format settings
The datepicker was built to be date implementation agnostic. This means that it can be made to work
with a variety of different date implementations. However it also means that developers need to make