openHPI / jenz

Dashboard visualising the usage of MOOC-Platforms like openHPI, openSAP and more.
https://openhpi.github.io/jenz/
0 stars 2 forks source link

m.e.i.n.e.l for statistics #13

Open flowirtz opened 7 years ago

flowirtz commented 7 years ago

Add the m.e.i.n.e.l-project which provides polymer components for easily displaying statistics from data APIs.

Main problem: Use Polymer components in Angular 2.

flowirtz commented 6 years ago

Well... Here is the deal: I attempted to include the meinel-components in multiple ways now. The most promising seems to be following this guide. Apart from the guide being kinda outdated and not working fully, especially the delay in loading by using main-polymer.ts the polymer cli complains about the missing bootstrapModule (fixed below), I am facing one major issue:

The major issue

ERROR in Error encountered resolving symbol values statically. Calling function 'PolymerElement', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/ping/Desktop/Git/jenz/src/app/app.module.ts, resolving symbol AppModule in /Users/ping/Desktop/Git/jenz/src/app/app.module.ts

which basically means that PolymerElement('barchart-basic') in app.module.ts fails.

If you google that, you get a couple hints, but angular-cli guys basically say that this won't be supported anymore. A bummer.

How to fix

Either, figure out a way to bypass the mentioned error (maybe by exporting them by hand), or find a completely different way to turn Polymer components into angular2 ones in general.

Every change leading to this error is shown in the add-meinel branch.

flowirtz commented 6 years ago

How to bypass bootstrapModule() missing

This. is. ugly. Yes. But it works and I don't see a better way atm thanks to angular cli.

// Ugly hack to convince Angular CLI that we call bootstrapModule somewhere
const hackThis = false;
if (hackThis) {
  platformBrowserDynamic().bootstrapModule(AppModule);
}

in main-polymer.ts