         link: link
     }
 
-module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory",
+module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory", "tgCurrentUserService",
                                     LeaveProjectDirective])
 
 

## Leave project Directive
#############################################################################

LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory) ->
    link = ($scope, $el, $attrs) ->
        leaveConfirm = () ->
            leave_project_text = $translate.instant("TEAM.ACTION_LEAVE_PROJECT")

                promise = $rs.projects.leave($scope.project.id)

                promise.then =>
                    currentUserService.loadProjects().then () ->
                        response.finish()
                        $confirm.notify("success")
                        $location.path($navurls.resolve("home"))

                promise.then null, (response) ->
                    response.finish()
