11angular . module ( 'ui.bootstrap-slider' , [ ] )
2- . directive ( 'slider' , [ '$parse' , '$timeout' , function ( $parse , $timeout ) {
2+ . directive ( 'slider' , [ '$parse' , '$timeout' , function ( $parse , $timeout ) {
33 return {
44 restrict : 'AE' ,
55 replace : true ,
66 template : '<input type="text" />' ,
77 require : 'ngModel' ,
8- link : function ( $scope , element , attrs , ngModelCtrl ) {
9- $ . fn . slider . Constructor . prototype . disable = function ( ) {
8+ link : function ( $scope , element , attrs , ngModelCtrl ) {
9+ $ . fn . slider . constructor . prototype . disable = function ( ) {
1010 this . picker . off ( ) ;
1111 } ;
1212
13- $ . fn . slider . Constructor . prototype . enable = function ( ) {
13+ $ . fn . slider . constructor . prototype . enable = function ( ) {
1414 this . picker . on ( ) ;
1515 } ;
1616
17- if ( attrs . ngChange ) {
18- ngModelCtrl . $viewChangeListeners . push ( function ( ) {
19- $scope . $apply ( attrs . ngChange ) ;
20- } ) ;
21- }
17+ if ( attrs . ngChange ) {
18+ ngModelCtrl . $viewChangeListeners . push ( function ( ) {
19+ $scope . $apply ( attrs . ngChange ) ;
20+ } ) ;
21+ }
2222
23- var options = { } ;
24- if ( attrs . sliderid ) options . id = attrs . sliderid ;
25- if ( attrs . min ) options . min = parseFloat ( attrs . min ) ;
26- if ( attrs . max ) options . max = parseFloat ( attrs . max ) ;
27- if ( attrs . step ) options . step = parseFloat ( attrs . step ) ;
28- if ( attrs . precision ) options . precision = parseFloat ( attrs . precision ) ;
29- if ( attrs . orientation ) options . orientation = attrs . orientation ;
30- if ( attrs . value ) {
23+ var options = { } ;
24+ if ( attrs . sliderid ) options . id = attrs . sliderid ;
25+ if ( attrs . min ) options . min = parseFloat ( attrs . min ) ;
26+ if ( attrs . max ) options . max = parseFloat ( attrs . max ) ;
27+ if ( attrs . step ) options . step = parseFloat ( attrs . step ) ;
28+ if ( attrs . precision ) options . precision = parseFloat ( attrs . precision ) ;
29+ if ( attrs . orientation ) options . orientation = attrs . orientation ;
30+ if ( attrs . value ) {
3131 if ( angular . isNumber ( attrs . value ) || angular . isArray ( attrs . value ) ) {
3232 options . value = attrs . value ;
3333 } else if ( angular . isString ( attrs . value ) ) {
@@ -39,19 +39,19 @@ angular.module('ui.bootstrap-slider', [])
3939 }
4040
4141 }
42- if ( attrs . range ) options . range = attrs . range === 'true' ;
43- if ( attrs . selection ) options . selection = attrs . selection ;
44- if ( attrs . tooltip ) options . tooltip = attrs . tooltip ;
45- if ( attrs . tooltipseparator ) options . tooltip_separator = attrs . tooltipseparator ;
46- if ( attrs . tooltipsplit ) options . tooltip_split = attrs . tooltipsplit === 'true' ;
47- if ( attrs . handle ) options . handle = attrs . handle ;
48- if ( attrs . reversed ) options . reversed = attrs . reversed === 'true' ;
49- if ( attrs . enabled ) options . enabled = attrs . enabled === 'true' ;
50- if ( attrs . naturalarrowkeys ) options . natural_arrow_keys = attrs . naturalarrowkeys === 'true' ;
51- if ( attrs . formater ) options . formater = $scope . $eval ( attrs . formater ) ;
42+ if ( attrs . range ) options . range = attrs . range === 'true' ;
43+ if ( attrs . selection ) options . selection = attrs . selection ;
44+ if ( attrs . tooltip ) options . tooltip = attrs . tooltip ;
45+ if ( attrs . tooltipseparator ) options . tooltip_separator = attrs . tooltipseparator ;
46+ if ( attrs . tooltipsplit ) options . tooltip_split = attrs . tooltipsplit === 'true' ;
47+ if ( attrs . handle ) options . handle = attrs . handle ;
48+ if ( attrs . reversed ) options . reversed = attrs . reversed === 'true' ;
49+ if ( attrs . enabled ) options . enabled = attrs . enabled === 'true' ;
50+ if ( attrs . naturalarrowkeys ) options . natural_arrow_keys = attrs . naturalarrowkeys === 'true' ;
51+ if ( attrs . formater ) options . formater = $scope . $eval ( attrs . formater ) ;
5252
5353 if ( options . range && ! options . value ) {
54- options . value = [ 0 , 0 ] ; // This is needed, because of value defined at $.fn.slider.defaults - default value 5 prevents creating range slider
54+ options . value = [ 0 , 0 ] ; // This is needed, because of value defined at $.fn.slider.defaults - default value 5 prevents creating range slider
5555 }
5656
5757 var slider = $ ( element [ 0 ] ) . slider ( options ) ;
@@ -65,7 +65,7 @@ angular.module('ui.bootstrap-slider', [])
6565 } ) ;
6666
6767 $scope . $watch ( attrs . ngModel , function ( value ) {
68- if ( value || value === 0 ) {
68+ if ( value || value === 0 ) {
6969 slider . slider ( 'setValue' , value , false ) ;
7070 }
7171 } ) ;
@@ -81,5 +81,4 @@ angular.module('ui.bootstrap-slider', [])
8181 }
8282 }
8383 } ;
84- } ] )
85- ;
84+ } ] ) ;
0 commit comments