1- /* [email protected] .7 2015-10-13 */ 1+ /* [email protected] .8 2015-10-21 */ 22// shim layer with setTimeout fallback
33// credit Erik Möller and http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
44'use strict' ;
@@ -55,6 +55,20 @@ angular.module('angular-svg-round-progress').constant('roundProgressConfig', {
5555angular . module ( 'angular-svg-round-progress' ) . service ( 'roundProgressService' , [ function ( ) {
5656 var service = { } ;
5757 var isNumber = angular . isNumber ;
58+ var base = document . head . querySelector ( 'base' ) ;
59+
60+ // fixes issues if the document has a <base> element
61+ service . resolveColor = base && base . href ? function ( value ) {
62+ var hashIndex = value . indexOf ( '#' ) ;
63+
64+ if ( hashIndex > - 1 && value . indexOf ( 'url' ) > - 1 ) {
65+ return value . slice ( 0 , hashIndex ) + window . location . href + value . slice ( hashIndex ) ;
66+ }
67+
68+ return value ;
69+ } : function ( value ) {
70+ return value ;
71+ } ;
5872
5973 // credits to http://modernizr.com/ for the feature test
6074 service . isSupported = ! ! ( document . createElementNS && document . createElementNS ( 'http://www.w3.org/2000/svg' , "svg" ) . createSVGRect ) ;
@@ -384,7 +398,7 @@ angular.module('angular-svg-round-progress')
384398 } ) ;
385399
386400 ring . css ( {
387- "stroke" : options . color ,
401+ "stroke" : service . resolveColor ( options . color ) ,
388402 "stroke-width" : stroke ,
389403 "stroke-linecap" : options . rounded ? "round" : "butt"
390404 } ) ;
@@ -400,7 +414,7 @@ angular.module('angular-svg-round-progress')
400414 "cy" : radius ,
401415 "r" : backgroundSize >= 0 ? backgroundSize : 0
402416 } ) . css ( {
403- "stroke" : options . bgcolor ,
417+ "stroke" : service . resolveColor ( options . bgcolor ) ,
404418 "stroke-width" : stroke
405419 } ) ;
406420 } ;
@@ -484,7 +498,7 @@ angular.module('angular-svg-round-progress')
484498 '<svg class="' + directiveName + '" xmlns="http://www.w3.org/2000/svg">' ,
485499 '<circle fill="none"/>' ,
486500 '<path fill="none"/>' ,
487- '<g ng-transclude width ></g>' ,
501+ '<g ng-transclude></g>' ,
488502 '</svg>'
489503 ] ;
490504
0 commit comments