@@ -10,7 +10,7 @@ angular.module('ui.bootstrap.progressbar', [])
10
10
animate = angular . isDefined ( $attrs . animate ) ? $scope . $parent . $eval ( $attrs . animate ) : progressConfig . animate ;
11
11
12
12
this . bars = [ ] ;
13
- $scope . max = angular . isDefined ( $scope . max ) ? $scope . max : progressConfig . max ;
13
+ $scope . max = getMaxOrDefault ( ) ;
14
14
15
15
this . addBar = function ( bar , element , attrs ) {
16
16
if ( ! animate ) {
@@ -19,7 +19,7 @@ angular.module('ui.bootstrap.progressbar', [])
19
19
20
20
this . bars . push ( bar ) ;
21
21
22
- bar . max = $scope . max ;
22
+ bar . max = getMaxOrDefault ( ) ;
23
23
bar . title = attrs && angular . isDefined ( attrs . title ) ? attrs . title : 'progressbar' ;
24
24
25
25
bar . $watch ( 'value' , function ( value ) {
@@ -50,12 +50,17 @@ angular.module('ui.bootstrap.progressbar', [])
50
50
} ) ;
51
51
} ;
52
52
53
- $scope . $watch ( 'max' , function ( max ) {
53
+ //$attrs.$observe('maxParam', function(maxParam) {
54
+ $scope . $watch ( 'maxParam' , function ( maxParam ) {
54
55
self . bars . forEach ( function ( bar ) {
55
- bar . max = $scope . max ;
56
+ bar . max = getMaxOrDefault ( ) ;
56
57
bar . recalculatePercentage ( ) ;
57
58
} ) ;
58
59
} ) ;
60
+
61
+ function getMaxOrDefault ( ) {
62
+ return angular . isDefined ( $scope . maxParam ) ? $scope . maxParam : progressConfig . max ;
63
+ }
59
64
} ] )
60
65
61
66
. directive ( 'uibProgress' , function ( ) {
@@ -65,7 +70,7 @@ angular.module('ui.bootstrap.progressbar', [])
65
70
controller : 'UibProgressController' ,
66
71
require : 'uibProgress' ,
67
72
scope : {
68
- max : '=?'
73
+ maxParam : '=?max '
69
74
} ,
70
75
templateUrl : 'uib/template/progressbar/progress.html'
71
76
} ;
@@ -94,7 +99,7 @@ angular.module('ui.bootstrap.progressbar', [])
94
99
controller : 'UibProgressController' ,
95
100
scope : {
96
101
value : '=' ,
97
- max : '=?' ,
102
+ maxParam : '=?max ' ,
98
103
type : '@'
99
104
} ,
100
105
templateUrl : 'uib/template/progressbar/progressbar.html' ,
0 commit comments