angular2 d3.event.sourceEvent does not exist
angular2 d3.event.sourceEvent does not exist
试图在 angular2 上使用 d3 执行拖动功能我找到了一个示例,但在 JS 中并尝试在 ng2 中使用它,但是我对 .sourceEvent 有问题,它说它不是 d3.event 属性的一部分。
JS类型 : https://bl.ocks.org/mbostock/6123708
public canvas = d3.select('my-app')
.append('canvas')
.attr('width', this.width)
.attr('height', this.height)
.attr('class', 'canvas');
public drag = d3.behavior.drag()
.on("drag", this.dragstart);
dragstart (d) {
d3.event.sourceEvent.stopPropagation();
d3.select(this).classed("dragging", true);
}
尝试改用d3.event.stopPropagation()
。
并预测您的下一个错误... d3.select(this)
在 Angular2 中不起作用,因为 this
关键字与 Angular 组件相关。使用 d3.select(d3.event.target)
.
相关文章:
- jQuery is not loaded
- AngularJS JSON not arriving php
- $rootScope not working
- reactRedux is not defined
- jQuery document.ready not working
- Javascript/Jquery Blob not showing Chrome PDF
- ReferenceError: not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Javascript getElementsByTagName not working?
- jQuery's trim()的前缀为not运算符
- Javascript - element.childNodes does not see an append.newch
- SemanticUI模态not onDeny/onApprove事件未激发
- WebkitTransform not fluent
- JQuery.val( ) not working
- Tomcat websocket is not working
- Nunjucks nl2br does not exist?
- YDN-DB getting Store: null not exist
- Mapbox {"message":"Tileset does not exist&quo
- Angular 2 - 'imports' does not exist in type 'Co
- angular2 d3.event.sourceEvent does not exist