誰かが同様の問題を思いついた場合、angular $timeout serviceを使用すると役立つかもしれません。問題は、私のようにプログレス バーがたくさんある場合 (1 ページに 200 以上)、特に Google Chrome を使用していないユーザーの場合、パフォーマンスに問題が発生することです。
更新された 'progressbar' ディレクティブは次のとおりです。
.directive('progressbar', ['$transition', '$timeout', function($transition, $timeout) {
return {
restrict: 'EA',
replace: true,
scope: {
width: '=',
old: '=',
type: '=',
animate: '='
},
templateUrl: 'template/progressbar/bar.html',
link: function(scope, element) {
$timeout(function(){
scope.$watch('width', function(value) {
if (scope.animate) {
element.css('width', scope.old + '%');
$transition(element, {width: value + '%'});
} else {
element.css('width', value + '%');
}
});
},100)
}
};
}]);