Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use angular 2 components written in typescript inside a dart project

Tags:

I'm using dart to develop an angular 2 project. I've seen some interesting component libraries written in typescript that I would like to use inside my app. Is it possible? If yes, how? I googled a lot but I couldn't find any hint...

like image 564
J F Avatar asked Jun 09 '16 16:06

J F


1 Answers

There is no way to do that.

You would need to port the elements source to Dart. The ts2dart tool might help, but if the TypeScript code is not built with ts2dart in mind, then it will only be able to translate parts of the code.

You might argue that Polymer.js elements can be used in Polymer.dart, but Polymer.dart itself is just a wrapper for Polymer.js and Polymer elements are wrapped in a similar way. Because Dart Angular2 is entirely Dart code this approach is not available.

Angular also requires build tools to be applied to the components code and these build tools are different for TS and Dart.

Dart and JS Polymer elements can be use with Dart Angular2 though.

like image 113
Günter Zöchbauer Avatar answered Oct 13 '22 00:10

Günter Zöchbauer