简体   繁体   English

在Angular UI Datepicker中更改按钮类

[英]Changing button classes in Angular UI Datepicker

In this plunk I have an Angular UI Datepicker that uses a template. 在这个小精灵中,我有一个使用模板的Angular UI Datepicker。 I need to change the colors of the "Today", "Clear" and "Close" buttons but changing them in popup.html doesn't work. 我需要更改“今天”,“清除”和“关闭”按钮的颜色,但是在popup.html中更改它们不起作用。 It should show gray, orange and blue buttons. 它应该显示灰色,橙色和蓝色按钮。

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? 如何解决这个问题?

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 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM