0

I'm trying to use the md-date-locale directive to overwrite angular material options for one date-picker input (as specified in https://material.angularjs.org/latest/api/directive/mdDatepicker) but it's not working.

Here is an example using the angular material example to test

md-date-locale="{ firstDayOfWeek: 2 }"

http://codepen.io/Hyperalpha/pen/gmwMdm

If it's not possible, I need to update datepicker options after loading (not in module.config() ).

Thanks

1 Answer 1

2

You need to set firstDayOfWeek in config function then its working fine

myAppModule.config(function($mdDateLocaleProvider) {
  $mdDateLocaleProvider.firstDayOfWeek = 2;
});

Working codepen

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Gaurav but I want to update this parameter dynamically and I don't know if it's possible with the config function.
use $mdDateLocale service in controller for dynamic update, I have updated the codepen, check now
It works ! I was using $mdDateLocaleProvider in my controller instead of $mdDateLocale to update dynamically this value (=> generate an error). With $mdDateLocale it works perfectly. Thanks Gaurav

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.