EPLKleijntjens
EPLKleijntjens

Reputation: 936

How to make third party libraries play nice with angular 2's renderer?

I want to use a library like chart.js or d3.js inside angular 2. I understand how to make it work by passing them an ElementRef, but that would bypass the renderer. Is there any way (apart from rewriting chart.js or d3.js) to make the DOM manipulation of such libraries go through the angular 2 renderer so that server side rendering is still possible?

If not, I still want to prerender most of my page on the server. What would be the best way to detect if you're running in an environment where direct DOM manipulation isn't possible so that you can skip rendering certain directives?

Upvotes: 0

Views: 134

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657466

If not ...

I guess

DOM instanceOf BrowserDomAdapter

should give you this information.

There is an issue currently though https://github.com/angular/angular/issues/6904

Upvotes: 0

Related Questions