Replace $scope.$apply(refreshAttr) by $scope.$eval(refreshAttr)