fperucic / treant-js

Treant.js - javascript library for drawing tree diagrams
MIT License
862 stars 314 forks source link

Using treant-js with angular? #53

Open jackshealy opened 7 years ago

jackshealy commented 7 years ago

Hi, I've installed Treant using npm to use in my node application and it is now stored as a node module. I'm using angular for the front-end of my application and i'm just wondering could someone tell me how to use Treant with Angular?

I was able to get Treant working fine through javascript and html outside my application but when i try to use it with Angular in my app nothing gets displayed in the browser. I'm not sure if i'm requiring the library correctly or if i need to create a controller to display the tree's etc. If someone could tell me the general way of using this library with angular that would be great. Thank you.

alignsoft commented 7 years ago

I'm trying to use Treant in an Angular2 project as well, and I'm not getting anywhere. Some help in this regard would be very much appreciated!

alignsoft commented 7 years ago

For anyone trying to integrate this into an Angular2 project, I've asked and answered a question on StackOverflow that provides everything you'll need to make the Tennis Draw example work.

http://stackoverflow.com/questions/43165371/integrating-treant-js-in-angular2-project/43171601#43171601

skiraikou commented 7 years ago

@alignsoft do you use threant as any or you created the custom d.ts ? and what you have in cli/webpack config ?

alignsoft commented 7 years ago

@PfxMobile I typed is as any. I may go back when I have more time and create the d.ts file for it, and if I do, I'll make it available - probably submit to DefinitelyTyped or the appropriate outlet. Importing the file into my index.html file and referencing it via the window object means I don't have to do any webpack configuration to support it, but it does require that I distribute the js file as a separate import via my static assets directory for deployment.

skiraikou commented 7 years ago

@alignsoft thanks Will try to create basic d.ts and bundle with webpack.

pyriceti commented 7 years ago

@alignsoft Hello I've seen your post on stackoverflow and thanks to you I've been able to integrate Treant-js to my Angular 4 projet. However, I fail to add some Angular basic directives or data binding in the nodes, it seems the html generated isn't analyzed by Angular in the component life hook... I've post my issue there: .

I've found a very ugly fix right now, using the ComponentFactory, but it's leading me nowhere with more and more issues appearing now.

Have you encountered this kind of problem, and maybe a fix for it?

Thanks a lot

alignsoft commented 7 years ago

@bperraud Can you post a link to your StackOverflow question? I'm not sure if I can help or not, but I'll certainly give it a look and try

pyriceti commented 7 years ago

@alignsoft sorry I've messed up with the link, here you are, thank for your attention! https://stackoverflow.com/q/46392909/8658784

vladdmanole commented 6 years ago

Hello friends! I found this issue while searching on google and thanks to the help of @alignsoft I managed to do it. I'll leave this here, maybe it will help somebody one day. https://github.com/vladdmanole/angular-treantjs-test