I have included a code snippet below.
sample.js
(function() {
/*global angular */
'use strict';
angular.module('myapp', ['spinner'])
.controller('myCtrl', ['$scope', '$window', function ($scope, $window ) {
$scope.methodname = function() {
if(something){
/* Doing some operations */
}
};
// Define the callme javascript function here
function callme(response){
/* If I call like this, I'm getting an error in the console. */
}
}]); /* Controller ends here */
/* Creating a new anonymous function to perform some operations */
(function () {
'use strict';
// Making use of controller parameters inside callme function
code.util.myHTTP(url, function (response) {
// Adding response to session storage
callme(response);
}, function () {
// Removing from session storage
});
})();
}());
In this context, I am encountering difficulties calling the callme javascript function within the angular controller. The error message appearing in the console is:
Uncaught ReferenceError: callme is not defined
Is there a solution for this issue?
Edit:
The reason why I am defining the callme function within the controller is the necessity to utilize certain controller parameters inside that function.
I have already executed a function in my js file as shown below
.run(function($rootScope, $log, $window) {
});
How can I incorporate myCtrl within this setup?