Ng-if troubles


I have a problem while using ng-if statement inside an embedded form.
I have such a construction:

<input ng-if="requestDocument2Available" cam-variable-name="requestDocument2" cam-variable-type="File"
    cam-max-filesize="10000000" type="file" class="form-control"/>

By using nf-if it seems that even if the boolean operation result is true, the variable requestDocument2 is not created inside the camForm.variableManager.

Therefore if the file is selected it is never attached for download even if the current step is completed and form submits successfully.

Is there a way to update the variableManager with this variable to get this file uploaded for download?

I hope I explained it correctly. I would gladly give more info if needed.

Thanks and kind regards,


Would really appreciated some advise if possible :slight_smile:

Thanks and Kind regards,

You should use ng-show which does not create a new child scope.
Camunda directives don’t work well with child scopes.

If you have to use ng-if then you have to bind all variables to the variableManager manually. You can find the where and how in the documentation;


Thanks. I don’t think I can use ng-show, since the variable directives are always initialised in this case.

I have two upload fields. Upload1 and Upload2.

  1. User selects only one file.
  2. variableManager.destroyVariable deletes the empty Upload2 upon submit, since it is empty.
  3. Second form checks if there is Upload2 or not;
  4. By using ng-if it is decided if will show either download link (if Upload2 was not empty) or a new upload field (if Upload2 was empty) by using the same cam-variable-name Upload2.

The problem is that by using ng-if the cam-variable-type and cam-variable-name are never initialized… currently I do not have a solution for this issue.

Kind regards,

If you run Camunda 7.4 you will run into troubles anyway… There is a bug that crashes the form when you use a camunda file directive that is not defined. You then have to create a variable with name Upload2 and value null.

My suggestion; keep form1 as it is and use REST-services in form2 instead of the camunda directives.
This way you will go around the empty file bug + you can use ng-if as you do not use the directives.

GET variable (binary)

GET local variable (binary)

1 Like


That’s a great idea, thanks! But what about file upload in form2?

Kind regards,

Then you use the POST method.

Post Task Variable (Binary)

Also discussed in the following topic;



Thanks! This works perfectly! Now I think my troubles are solved. Thanks once again! I will update the post with my solution later.

Kind regards,