So I have Googled this quite allot today, and I'm afraid the answers I got, did not satisfy the problem I'm facing. I'm trying to call a method within a controller (controller as syntax) by only using a string value.
I tried window['someFunctionName'](); as well as this['someFunctionName'](); and vm['someFunctionName'](), but non of them seems to work. I'm guessing it's because the function I'm calling is not in a global space, but rather local to the controller - example:
/* @ngInject */
function dashboardController(logger, _, moment) {
var vm = this;
vm.foo = foo
function getSomeData() {
// do something....
}
function foo() {
window['getSomeData']();
this['getSomeData']();
vm['getSomeData']();
}
}
It feels so trivial ... I could do this soooooo easily in C#, but struggling with something that feels so silly!
Any advice? Thanks!