I'm defining a jquery ui-grid component in my controller, the minified example of which is shown below:
class myController {
constructor($scope) {
this.$scope = $scope;
this.Grid = {
selectionSettings:{
clientHandler:function(key,object,data){
console.log(key);
console.log(object);
console.log(data);
console.log(this);
return data;
//the scope of this function is different from the controller scope.
}
}
}
receiver(data){
doSomething(data);
}
...
The idea is that when I select an entry within the grid, the function within clientHandler is fired. I then want this function to pass that data to the receiver function in this class.
But since this clientHandler
function and receiver()
are in different scopes, I'm not able to do so directly using the this
keyword.
Other answers on stackoverflow recommend using the $scope
object to accomplish the same, but I'm not able to do so.
What is needed to make the clientHandler
function call receiver()
?
Any guidance is earnestly welcomed. Thanks