Closed reymondVillaluz closed 6 years ago
@reymondVillaluz Looking for a similar solution. Found anything?
@reymondVillaluz if you want to call an angular2 method from an elementClick event. try using the arrow function.
multibar: { dispatch:{ elementClick: (e) => { console.log(this.somevariablename); //now you can access this.variables and this.methods related to your component. } } }
@reymondVillaluz Did the solution work for you? - if yes, can you close the issue? :)
Hi,
I am trying to call an angular 2 method on the elementClick on multibar is that possible? I am using angular 2 type script and ng2-nvd3. console.log and alerts are working properly but when I am trying to log a angular 2 variable./method it is undefined.
here is the sample code:
multibar: { dispatch:{ elementClick: function(t, u){ console.log(this.somevariablename); //alert('click event is fired! data: ' + t['data'].value); } } } Thanks!