             if invitations.length
                 invitation_extra_text = $el.find("form textarea").val()
 
-                $rs.memberships.bulkCreateMemberships($scope.project.id, invitations, invitation_extra_text).then(onSuccess, onError)
+                promise = $rs.memberships.bulkCreateMemberships($scope.project.id,
+                                                      invitations, invitation_extra_text)
+                promise.then(onSuccess, onError)
 
         submitButton = $el.find(".submit-button")
 

## Create Members Lightbox Directive
#############################################################################

CreateMembersDirective = ($rs, $rootScope, $confirm, $loading ,lightboxService, $compile) ->
    extraTextTemplate = """
    <fieldset class="extra-text">
        <textarea placeholder="{{'LIGHTBOX.CREATE_MEMBER.PLACEHOLDER_INVITATION_TEXT' | translate}}" maxlength="255"></textarea>
    </fieldset>
    """

    template = _.template("""
    <div class="add-member-wrapper">
        <fieldset>
            <input type="email" placeholder="{{'LIGHTBOX.CREATE_MEMBER.PLACEHOLDER_TYPE_EMAIL' | translate}}" <% if(required) { %> data-required="true" <% } %> data-type="email" />
        </fieldset>
        <fieldset>
            <select <% if(required) { %> data-required="true" <% } %> data-required="true">


    return {link: link}

module.directive("tgLbCreateMembers", ["$tgResources", "$rootScope", "$tgConfirm", "$tgLoading",
                                       "lightboxService", "$compile", CreateMembersDirective])
