In a specific project framework, we use WCM Jahia
to integrate our Angular 5 modules to display them in the various pages of the site.
The WCM jahia properties that we must recover to integrate them and use them in our modules Angular 5, it consists in recovering a list of key/value of some data.
We managed to code this solution for the moment, and it works (Except on IE9):
file_name.jsp
<script type="text/javascript" src="...../dist/polyfills.bundle.js"> </script>
<script type="text/javascript" src="...../dist/vendor.bundle.js"> </script>
<script type="text/javascript" src="...../dist/main.bundle.js"> </script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var myProperties = {
//For example
codes: "codes",
labels: "labels"
};
window.run(myProperties);
});
</script>
<app-myApp></app-myApp>
main.ts
window['run'] = (myProperties) => {
platformBrowserDynamic([
{
provide: 'myProperties',
useValue: myProperties
},
...
])
.bootstrapModule(AppModule)
.catch(err => console.log(err));
};
The problem is that this solution does not work if we use IE9 (We don't get to bootstrap the Angular 5 application) because of window['run']
...
The question is, is there another way to retrieve a list of variable/value form a JAHIA Jsp and inject it into the provide
before bootstrapModule
Angular?
After some research and a few drops of sweat, the solution is finally found.
This consists of just uncommenting a part of the polyfills.ts
file that relates to the IE9, IE10 and IE11 browsers.
polyfills.ts
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
I hope this can help someone in the same case.