更改Angular UI Datepicker中的按钮类

时间:2021-06-24 19:36:58

In this plunk I have an Angular UI Datepicker that uses a template. I need to change the colors of the "Today", "Clear" and "Close" buttons but changing them in popup.html doesn't work. It should show gray, orange and blue buttons.

在这个插件中,我有一个使用模板的Angular UI Datepicker。我需要更改“今天”,“清除”和“关闭”按钮的颜色,但在popup.html中更改它们不起作用。它应该显示灰色,橙色和蓝色按钮。

I changed from

我改变了

<li ng-if="showButtonBar" class="uib-button-bar">
  <span class="btn-group pull-left">
    <button type="button" class="btn btn-sm btn-info uib-datepicker-current" ng-click="select('today', $event)" ng-disabled="isDisabled('today')">{{ getText('current') }}</button>
    <button type="button" class="btn btn-sm btn-danger uib-clear" ng-click="select(null, $event)">{{ getText('clear') }}</button>
  </span>
  <button type="button" class="btn btn-sm btn-success pull-right uib-close" ng-click="close($event)">{{ getText('close') }}</button>
</li>

to

<li ng-if="showButtonBar" class="uib-button-bar">
  <span class="btn-group pull-left">
    <button type="button" class="btn btn-sm btn-default uib-datepicker-current" ng-click="select('today', $event)" ng-disabled="isDisabled('today')">{{ getText('current') }}</button>
    <button type="button" class="btn btn-sm btn-warning uib-clear" ng-click="select(null, $event)">{{ getText('clear') }}</button>
  </span>
  <button type="button" class="btn btn-sm btn-primary pull-right uib-close" ng-click="close($event)">{{ getText('close') }}</button>
</li>

Note that I changed the button class names to change the color, but when I inspect in the browser, the datepicker is still using the old classes. How to fix this?

请注意,我更改了按钮类名称以更改颜色,但是当我在浏览器中检查时,datepicker仍然使用旧类。如何解决这个问题?

1 个解决方案

#1


2  

To set a custom popup template use datepicker-popup-template-url attribute, for example:

要设置自定义弹出模板,请使用datepicker-popup-template-url属性,例如:

<input datepicker-popup-template-url="popup.html"  type="text" class="form-control" is-open="true" ng-model="dt" uib-datepicker-popup="MM-dd-yyyy"
            datepicker-options="dateOptions" close-text="Close" popup-placement="bottom-left" on-open-focus="false" />

Demo

#1


2  

To set a custom popup template use datepicker-popup-template-url attribute, for example:

要设置自定义弹出模板,请使用datepicker-popup-template-url属性,例如:

<input datepicker-popup-template-url="popup.html"  type="text" class="form-control" is-open="true" ng-model="dt" uib-datepicker-popup="MM-dd-yyyy"
            datepicker-options="dateOptions" close-text="Close" popup-placement="bottom-left" on-open-focus="false" />

Demo