When i add the below line of code to a controller in a lightning component I get a Javascript error saying.
var input = {
callback : $A.getCallback(function(result) {
alert(JSON.stringify(result));
});
};
Uncaught Error in $A.getCallback() [Cannot read property 'apply' of undefined] throws at http://adarshakb2.lightning.localhost.force.com:6109/l/%7B%22mode%22%3A%22DEV%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22upZaWQWEemyWxA8BDbVXtg%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22Hdm40jpREpk5B2bFA5qAdg%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22YN%22%7D/app.js:86682:21 at value (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:16166:18) at Object.create (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:16277:66) at Object.$createForDef$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:16255:17) at eval (eval at (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:1441:10), :4:97) at ComponentClassRegistry.$getComponentClass$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:3907:33) at AuraComponentService.$getComponentClass$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:10907:40) at AuraComponentService.$createComponentPriv$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:11397:33) at aura$component.Component.$createComponentStack$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:5284:49) at aura$component.Component.$setupAttributes$ (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:5421:29) at aura$component.Component (http://adarshakb2.lightning.localhost.force.com:6109/auraFW/javascript/upZaWQWEemyWxA8BDbVXtg/aura_dev.js:4261:8)
What is wrong? I have wrapped the callback as suggested in https://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/rn_lightning_get_callback.htm.
I am using locker service to display this component in lightning app.