         require: "ngModel"
     }
 
-module.directive("tgUsTeamRequirementButton", ["$rootScope", "$tgRepo", "$tgConfirm", UsTeamRequirementButtonDirective])
+module.directive("tgUsTeamRequirementButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", UsTeamRequirementButtonDirective])
 
 
 #############################################################################
 ## User story client requirements button directive
 #############################################################################
 
-UsClientRequirementButtonDirective = ($rootscope, $tgrepo, $confirm) ->
+UsClientRequirementButtonDirective = ($rootscope, $tgrepo, $confirm, $loading) ->
     template = _.template("""
       <label for="client-requirement" class="button button-gray client-requirement">Client requirement</label>
       <input type="checkbox" id="client-requirement" name="client-requirement"/>

                us = $model.$modelValue.clone()
                us.client_requirement = not us.client_requirement
                $model.$setViewValue(us)
                promise = $tgrepo.save($model.$modelValue)
                promise.then ->
                    $rootscope.$broadcast("history:reload")
                promise.then null, ->
                    $confirm.notify("error")
                    us.revert()
                    $model.$setViewValue(us)

    return {
        link: link
        restrict: "EA"
        require: "ngModel"
    }
module.directive("tgUsClientRequirementButton", ["$rootScope", "$tgRepo", "$tgConfirm", UsClientRequirementButtonDirective])

## User story team requirements button directive
#############################################################################

UsTeamRequirementButtonDirective = ($rootscope, $tgrepo, $confirm, $loading) ->
    template = _.template("""
      <label for="team-requirement" class="button button-gray team-requirement">Team requirement</label>
      <input type="checkbox" id="team-requirement" name="team-requirement"/>
