My current component relies on "MAT_DATE_FORMATS", but I am encountering an issue where the "useValue" needs to be retrieved from the server. Is there a way to make the provider asynchronous in this case?
export const MY_FORMATS = {
parse: {
dateInput: 'LL',
},
display: {
dateInput:'YYYY-MM-DD',
monthYearLabel: 'YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'YYYY',
},
};
@Component({
selector: 'esp-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
providers: [
{provide: MAT_DATE_FORMATS, useValue: MY_FORMATS},
]
})
export class AppComponent implements OnInit
I am looking for a solution where the value of "dateInput" can be dynamically fetched from the server rather than being hard coded as shown here with "YYYY-MM-DD".