如何全局配置 Angular UI bootstrap 指令
How to configure Angular UI bootstrap directives globally
如何使用 uibDatepickerConfig
全局配置 bootstrap datepicker?该文档仅说明以下内容:
All settings can be provided as attributes in the uib-datepicker
or globally configured through the uibDatepickerConfig
.
在source code中,它们被定义为常量:
.constant('uibDatepickerConfig', {
formatDay: 'dd',
formatMonth: 'MMMM',
formatYear: 'yyyy',
formatDayHeader: 'EEE',
formatDayTitle: 'MMMM yyyy',
formatMonthTitle: 'yyyy',
datepickerMode: 'day',
minMode: 'day',
maxMode: 'year',
showWeeks: true,
startingDay: 0,
yearRange: 20,
minDate: null,
maxDate: null,
shortcutPropagation: false
})
完全相同的问题已在 this post 中讨论过,但解决方案似乎 已过时。
//where app is the module that depends on 'ui.bootstrap'
// probably your main app module
//for DatePicker options
app.config(['uibDatepickerConfig', function (uibDatepickerConfig) {
uibDatepickerConfig.showWeeks = false;
}]);
//for DatePickerPopup options
app.config(['uibDatepickerPopupConfig', function (uibDatepickerPopupConfig) {
uibDatepickerPopupConfig.closeText= 'Close';
uibDatepickerPopupConfig.placement = 'auto bottom';
}]);
如何使用 uibDatepickerConfig
全局配置 bootstrap datepicker?该文档仅说明以下内容:
All settings can be provided as attributes in the
uib-datepicker
or globally configured through theuibDatepickerConfig
.
在source code中,它们被定义为常量:
.constant('uibDatepickerConfig', {
formatDay: 'dd',
formatMonth: 'MMMM',
formatYear: 'yyyy',
formatDayHeader: 'EEE',
formatDayTitle: 'MMMM yyyy',
formatMonthTitle: 'yyyy',
datepickerMode: 'day',
minMode: 'day',
maxMode: 'year',
showWeeks: true,
startingDay: 0,
yearRange: 20,
minDate: null,
maxDate: null,
shortcutPropagation: false
})
完全相同的问题已在 this post 中讨论过,但解决方案似乎 已过时。
//where app is the module that depends on 'ui.bootstrap'
// probably your main app module
//for DatePicker options
app.config(['uibDatepickerConfig', function (uibDatepickerConfig) {
uibDatepickerConfig.showWeeks = false;
}]);
//for DatePickerPopup options
app.config(['uibDatepickerPopupConfig', function (uibDatepickerPopupConfig) {
uibDatepickerPopupConfig.closeText= 'Close';
uibDatepickerPopupConfig.placement = 'auto bottom';
}]);