From bf25a05d038809971c559c62811bad18e1a3d480 Mon Sep 17 00:00:00 2001 From: Albin Stjerna Date: Wed, 4 Jul 2018 10:22:52 +0200 Subject: [PATCH] Bug: force-directed-graph.ts emits the wrong value It emits `this`, should emit `this.simulation`. Additionally, the `function()` notation apparently causes the code to not be type-checked. Otherwise, a type mismatch warning would have been emitted! --- src/app/d3/models/force-directed-graph.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/d3/models/force-directed-graph.ts b/src/app/d3/models/force-directed-graph.ts index b0cf9c5..a48dd0b 100644 --- a/src/app/d3/models/force-directed-graph.ts +++ b/src/app/d3/models/force-directed-graph.ts @@ -79,9 +79,7 @@ export class ForceDirectedGraph { ); // Connecting the d3 ticker to an angular event emitter - this.simulation.on('tick', function () { - ticker.emit(this); - }); + this.simulation.on('tick', () => ticker.emit(this.simulation)); this.initNodes(); this.initLinks();