From e9f999f100dde4079b0a30afc0c1575b987a357f Mon Sep 17 00:00:00 2001 From: Denis Ciccale Date: Thu, 30 Jul 2015 19:09:45 +0200 Subject: [PATCH] group css properties avoid accessing the same node twice. you can pass an object of `key: value` pairs to the `.css()` method --- src/directive.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/directive.js b/src/directive.js index e649d99..efac2f3 100644 --- a/src/directive.js +++ b/src/directive.js @@ -20,8 +20,7 @@ angular.module('ngProgress.directive', []) $scope.$watch('color', function (newVal) { if (newVal !== undefined || newVal !== null) { $scope.color = newVal; - $element.eq(0).children().css('background-color', newVal); - $element.eq(0).children().css('color', newVal); + $element.eq(0).children().css({'background-color': newVal, 'color': newVal}); } }); $scope.$watch('height', function (newVal) {