Unable to include templates in form

Hi,

I have been attaching forms to user task in my Camunda workflows. Many of the forms have similar content and in order to reuse the common code, I created small html files which I tried including in my forms using ng-include. However, this does not work and when the project is deployed, I get a error which seems to say that the main form attached to user task is unable to find the html files that I tried to include using ng-include.

Is there a way to reuse html code that repeats across all the html files attached in user tasks?

Thanks,
Nikit

I guess the problem is that at first the form is fetched from a REST request and that afterwards angular tries to fetch the sources from a wrong location after parsing the directives. Check in dev tools which URL he tries to load.
I guess the include URL should start with the deployment context of your process as such:
ng-include="/deploy-context-name/xxx/some-template.html"/>

Hi Nikit,

are you using embedded forms? It’s possible that you need to get the context path of your application to correctly produce the path you need. Maybe this example can help.

Also be aware that ng-include creates a new scope in the form that the variableManager has no access to. You might need to manually manage the variables you want to send and retrieve.

Cheers
Sebastian

1 Like