Translating Angular Events into D3 Events

Converting or translating Angular events into d3 events was a lot easier than I thought it would be. Here’s the code:

disp = d3.dispatch('resize');
angular.element(window).bind('resize', function() {
    disp.resize('foobar');
});

disp.on('resize', function(arg) {
    console.log(arg);
    // resize code is here
});