Search code examples
htmlangulartypescriptyfiles

Angular 2 Yfiles for HTML - OrthogonalEdgeEditingContext


I'm working on a webApp in an Angular 2 application. I have integrated Yfiles for HTML but I need to force edge paths to only have right angles. This feature is possible with the orthogonalEdgeEditingContext function.

I have read the documentation here: documentation but this function doesn't work on Angular. Is it well implemented in angular?

graphEditorInputMode.orthogonalEdgeEditingContext = new yfiles.input.OrthogonalEdgeEditingContext();

I found an other example here : example je me suis inspiré de cet exemple pour créer la définition suivante:

var mode = this.graphComponent.inputMode = new yfiles.input.GraphEditorInputMode();
var OrthoEditing = mode.orthogonalEdgeEditingContext = new yfiles.input.OrthogonalEdgeEditingContext();
OrthoEditing.enabled = true;

But when running the app I have this error:

ERROR TypeError: yfiles.input.GraphEditorInputMode is not a constructor

If you have some recommendations for any assistance is appreciated!

Thanks in advance.


Solution

  • This probably means that you haven't loaded the right (or all) UMD modules and yfiles.input.GraphEditorInputMode is still undefined (and thus not a constructor). Make sure you have loaded the corresponding class definitions before instantiating the types.

    What makes you think that the documented functionality is not working in Angular specifically? Basically angular still is just JavaScript - it just adds lots of layers of code on top of everything and makes everything a lot harder ;-) - but still what works in a simple JavaScript application should also work in an angular environment.

    That being said: as a customer or evaluator you get support from yWorks directly and sharing large amounts of code is probably not something you will do on SO.