It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

AngularJS in Confluence

I have problem with AngularJS in Confluence. I tried to add angular files as web resource in atlassian-plugin.xml:

<web-resource name="Angular js files" key="angular-sources">
    <resource type="download" name="angular.js" location="js/angular/angular.js"/>
    <resource type="download" name="angular-animate.js" location="js/angular/angular-animate.js"/>
    <context>atl.general</context>
  </web-resource>

It works fine when I use atlas-run or atlas-debug. But when I generate new jar file using atlas-package and install it on new Confluence instance, my macro editor js files doesn't see variables defined in angular.js.

I tried also to add angular files directly in web resource for my new macro, but it also doesn't work:

<web-resource name="Resources - handle macros with JS" key="macroeditor-resources">
	<resource type="download" name="angular.js" location="js/angular/angular.js"/>
	<resource type="download" name="angular-animate.js" location="js/angular/angular-animate.js"/>
	…
	<resource type="download" name="page-move-dialog.js" location="js/page-move-dialog.js"/>
	<resource type="download" name="macro-editor-module.js" location="js/macro-editor-module.js"/>
	…
</web-resource>

It looks like a Confluence ignore the contents of the file angular.js. What may be the reason of that behavior? Below, fragment of javascript file generated by the Confluence. It has no content of angular.js:

try {
    /* module-key = 'plugin.key:angular-sources', location = 'js/angular/angular.js' */
    // HERE SHOULD BE INCLUDED angular.js
    } catch (err) {
        if (console && console.log && console.error) {
            console.log("Error running batched script.");
            console.error(err);
        }
    }
    
    
    try {
    /* module-key = 'plugin.key:angular-sources', location = 'js/angular/angular-animate.js' */
    (function(b,a,c){a.module("ngAnimate",["ng"]).config(["$provide","$animateProvider",function(g,i){var l=a.noop;var f=a.forEach;var j=i.$$selectors;var e=1;var h="$$ngAnimateState";var k="ng-animate";...
} catch (err) {
        if (console && console.log && console.error) {
            console.log("Error running batched script.");
            console.error(err);
        }
    }

There is other way to include angular files to Confluence?

1 answer

and what about to configure AngularJS and RequireJS?

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Thursday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

176 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you