@@ -72,7 +72,7 @@ function MdCheckboxDirective(inputDirective, $mdInkRipple, $mdAria, $mdConstant,
7272 function compile ( tElement , tAttrs ) {
7373
7474 tAttrs . type = 'checkbox' ;
75- tAttrs . tabIndex = 0 ;
75+ tAttrs . tabindex = tAttrs . tabindex || '0' ;
7676 tElement . attr ( 'role' , tAttrs . type ) ;
7777
7878 return function postLink ( scope , element , attr , ngModelCtrl ) {
@@ -85,7 +85,10 @@ function MdCheckboxDirective(inputDirective, $mdInkRipple, $mdAria, $mdConstant,
8585 ngModelCtrl . $setViewValue . bind ( ngModelCtrl )
8686 ) ;
8787 }
88-
88+ $$watchExpr ( 'ngDisabled' , 'tabindex' , {
89+ true : '-1' ,
90+ false : attr . tabindex
91+ } ) ;
8992 $mdAria . expectWithText ( element , 'aria-label' ) ;
9093
9194 // Reuse the original input[type=checkbox] directive from Angular core.
@@ -113,6 +116,16 @@ function MdCheckboxDirective(inputDirective, $mdInkRipple, $mdAria, $mdConstant,
113116
114117 ngModelCtrl . $render = render ;
115118
119+ function $$watchExpr ( expr , htmlAttr , valueOpts ) {
120+ if ( attr [ expr ] ) {
121+ scope . $watch ( attr [ expr ] , function ( val ) {
122+ if ( valueOpts [ val ] ) {
123+ element . attr ( htmlAttr , valueOpts [ val ] ) ;
124+ }
125+ } ) ;
126+ }
127+ }
128+
116129 function keypressHandler ( ev ) {
117130 var keyCode = ev . which || ev . keyCode ;
118131 if ( keyCode === $mdConstant . KEY_CODE . SPACE || keyCode === $mdConstant . KEY_CODE . ENTER ) {
0 commit comments