I am using the md-datepicker directive from angular-material, however i would like to typ in the date, not only choose it from the datepicker. I found the following example code
If you're having trouble loading the md-datepicker files and get it to be loaded into MEAN.JS check out this answer.
However if you are already correctly loading your files into your app and you just want to access the config block of the app you can do so by accessing the file located in /modules/core/client/app/init.js
, and in this code block just add the logic needed:
// Setting HTML5 Location Mode
angular
.module(app.applicationModuleName)
.config(bootstrapConfig);
function bootstrapConfig($compileProvider, $locationProvider, $httpProvider, $mdDateLocaleProvider) {
$locationProvider.html5Mode(true).hashPrefix('!');
$httpProvider.interceptors.push('authInterceptor');
// Disable debug data for production environment
// @link https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(app.applicationEnvironment !== 'production');
// md-datepicker configuration
$mdDateLocaleProvider.formatDate = function(date) {
return date ? moment(date).format('DD.MM.YYYY') : '';
};
$mdDateLocaleProvider.parseDate = function(dateString) {
var m = moment(dateString, 'DD.MM.YYYY', true);
return m.isValid() ? m.toDate() : new Date(NaN);
};
}
bootstrapConfig.$inject = ['$compileProvider', '$locationProvider', '$httpProvider', '$mdDateLocaleProvider'];
Don't forget to inject $mdDateLocaleProvider
in the config block.