score:2
Accepted answer
you need to specify the parameter in the call:
so in your directive it should be
function click(d) {
scope.logNode({d: d})
}
here is an example: http://jsfiddle.net/heavyhorse/7983y06k/
score:1
You may pass a model attaching some methods into the directive but I personally prefer using $.broadcast
service to keep my codebase cleaner.
Directive
function click(d) {
$rootScope.$broadcast('someEvent', d);
}
Controller
angular.module('gameApp')
.controller('ConnectionsController', ConnectionsController);
function ConnectionsController() {
var vm = this;
vm.$on('someEvent', function(event, data) {
console.log(data)
});
}
If you still think that passing methods around would make the trick for you, here is a simple example passing a method to the directive via a data model
Source: stackoverflow.com
Related Query
- How to pass data from directive to controller
- How to pass data from django to d3.js
- How to render a directive only after data is loaded from tsv in angular js
- How to pass a Json String from mvc controller to a d3.js chart?
- How can I pass json data returned from a webservice into D3.json(...)?
- How to get json data from controller in jsp?
- How to access stored data from d3 async calls in document.ready function to pass it to a function
- how to pass returned data stored as a variable from a d3.json call as an argument to circle radius
- How to load data from a CSV file in D3 v5
- In d3, how to get the interpolated line data from a SVG line?
- How to select unique values in d3.js from data
- How to load data from an internal JSON array rather than from an external resource / file for a collapsible tree in d3.js?
- How to pull data from mysql database and visualize with D3.JS?
- How to update elements of an HTML that the elements are created using data from a CSV file?
- D3 Library — How To Access Data from JSON in this example
- How to get the data from the c3.js
- How can I efficiently convert data from string to int within a d3 method chain?
- d3.js: how to join data from more sources
- D3.js: How to select data from graph's brushed area?
- D3.js : How to read data from JSON in Grouped Bar Chart
- how to get data with tsv or csv to array in d3.js from a txt file?
- How do I Bind Data from a .tsv to an SVG's paths using d3.js for a Choropleth Map
- How to create d3 graph using data from Rails database
- how to fetch data from postgresql using d3.js
- How to load external JSON data from a Web API in d3.js?
- How do I get data from a rectangle in D3?
- Passing JSON from Grails Controller to d3 - how to get the .gsp side working?
- How to read JSON data from same json for tree layout insteadof reading from other .JSON file?
- How to fetch data from json file to draw a dynamic graph by using d3.js
- how to visualize data from mysql database in force layout of d3 tool
More Query from same tag
- How to animate an object along a GeoJSON path using d3.js?
- add fixed parameter to await callback
- JS: Working with Sliders
- D3 parse number from string
- d3.js - Collapsible Force Layout - setting variable colors to leaf nodes
- X axis not displaying on bar chart using d3.js
- Handling nested data arrays
- Changing the color of an svg image
- How to filter a range of elements in d3js?
- Error while rendering D3 pie chart (not displaying properly)
- javascript d3 timeParse utcParse
- Using D3 in Jupyter - Text not displayed
- Using queue() to load multiple files and assign to globals
- D3.js : Uncaught TypeError: Cannot read property 'document' of undefined
- Remove empty groups from dc.js graph
- Scatterplot graphs line correctly, but points along the line have flipped along y-axis
- D3.js - why mouseover and mouse out fired for each child elements?
- Webpage on localhost cannot accessing Google Cloud Storage bucket file.csv
- How to get a dashed line on Y axis and how to display the value beside the graph in d3
- Integrating tabletop.js with d3.js?
- D3 overlay heatmap onto a map
- linking nodes of variable radius with arrows
- Got "Cannot read property 'getAttribute' of null" error
- Unable to get radius of circles in d3
- Integrating d3.js sunburst as data studio community visualisation
- Add event listener of a method present in another js file
- d3 js graph not displaying line
- Change json into tree data by javascript
- Get path data for multiple nodes
- how to set d3.brush extent right?