如何为ui-timepicker(angular bootsrap)设置tabindex?

时间:2017-01-26 11:32:52

标签: angularjs angular-ui-bootstrap

是否有可能修改箭头的tabindex并将其设置为-1(tabindex =“ - 1”)

以下是一个示例:http://angular-ui.github.io/bootstrap/versioned-docs/0.14.1/#/timepicker

2 个答案:

答案 0 :(得分:0)

我添加了tabindex attr并且效果很好。

  <uib-timepicker ng-model="mytime" ng-change="changed()" hour-step="hstep" tabindex="-1" minute-step="mstep" show-meridian="ismeridian"></uib-timepicker>

示例Plnkr

答案 1 :(得分:0)

我找到了这个解决方案,但我不知道还有另外一个比这更好的(修改箭头的tabindex)!!

this.$timeout(function () { // You might need this timeout to be sure its run after DOM render.
        angular.element( document.querySelectorAll( 'td.uib-increment.hours > .btn.btn-link' )).attr('tabindex','-1')
        angular.element( document.querySelectorAll( 'td.uib-increment.minutes > .btn.btn-link' )).attr('tabindex','-1')
        angular.element( document.querySelectorAll( 'td.uib-decrement.hours > .btn.btn-link' )).attr('tabindex','-1')
        angular.element( document.querySelectorAll( 'td.uib-decrement.minutes > .btn.btn-link' )).attr('tabindex','-1')
    }, 0, false)