Skip to content

Conversation

SimonSimCity
Copy link

This PR fixes logbon72#116 and opens up for a new way of setting default values. The service mdcDefaultParams now returns a method, which can be invoked with an object containing all the changes you want to have as your default settings for all datetimepicker.

The service mdcDatetimePickerDefaultLocale is kept for compatibility and it's setter internally just calls:

mdcDefaultParams({ lang: localeString });

Copy link

@hexadecy hexadecy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hexadecy hexadecy merged commit ca978e9 into beenote:gh-pages Aug 15, 2017
@SimonSimCity
Copy link
Author

You've only posted an example of how to set the default language. I would say that this way is rather deprecated in favor to the way for setting every properties default value.

The benefit with this method here is, that you can override every properties default value by injecting mdcDefaultParams and giving the properties you want to change as parameters of the first object. You can now f.e. after updating the default language, also set a new default for the button-texts with the following code:

mdcDefaultParams({ cancel-text: '', today-text: '', ok-text: '' });

Please also add this to your documentation since it shortens the HTML tag very much if you just want to have the same text everywhere - just translated to your language.

@hexadecy
Copy link

Ok, the demo now use:

mdcDefaultParams({
  lang: $scope.selectedLang,
  cancelText: $translate.instant('CANCEL'),
  todayText: $translate.instant('TODAY')
});

mdcDatetimePickerDefaultLocale will be deprecated in 1.9 with a console warning
I don't have plan to deprecate any attribute right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Language doesn't change when calling mdcDatetimePickerDefaultLocale.setDefaultLocale()
2 participants