I’m using for my project AngularJS, bootstrap for UI and of course GoJS.
I have an issue when my graphs (which is a directive) is inside a tab (not the first).
If i put the diagram in the first active tab everything works like a charm but if i put it in any other not active tab and push
the tab to open nothing is visible (well it seems that all elements get a width and height of 1px). I am getting no errors in console or anything else strange.
I tried to use so the requestUpdate() function by broadcasting to the directive that the tab is opened like this:
In my controller:
var $GO = go.GraphObject.make;
var diagram = // create a Diagram for the given HTML DIV element
$GO(go.Diagram, element[0], {
nodeTemplate: $GO(go.Node, "Auto", {
locationSpot: go.Spot.Center
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
//define a shape that holds the body
$GO(go.Shape, "RoundedRectangle", {
portId: "",
fromLinkable: scope.isEditable,
toLinkable: scope.isEditable,
fromLinkableSelfNode: false,
toLinkableSelfNode: false,
fromLinkableDuplicates: false,
toLinkableDuplicates: false,
width: 300,
stroke: defaultColor,
fill: "#fff",
margin: 0,
spot1: new go.Spot(0, 0),
spot2: new go.Spot(1, 1)
}), etc etc
So console.log(diagram instanceof go.Diagram) prints true when called in your scope’s event handler?
Well, if that’s the case, maybe the update that eventually happens after the call to Diagram.requestUpdate is happening too soon, maybe because Angular is causing an HTML reflow later. If so, can you have it be called later?
Unless we can reproduce the problem, we can only guess. If you don’t want to give us access to your app or give us a simple demonstration example, I don’t know how long it might be before we try to create an example ourselves.