following the DRY principal, i want to write a button directive which keeps button disabled for the duration of $http class.
I want to do this so as to forbid user from
Why not just make it easier.
$scope.save = function(){
$scope.isProcessing = true;
$http.post('Api/Controller/Save', data).success(
$scope.isProcessing = false;
);
}
Sure it's the case if you need this logic in very few places across your app.
If you have such logic repeating many times (and if you are not lazy :) ), so in order to follow SOLID principles it definetely better to wrap this functionality into directive (check out other answers for this question to see examples of such directive).