Reputation:
I have a controller with many functions defined on $scope
.
Ex:
$scope.doSomething = function() {
}
$scope.doSomethingElse = function(data) {
}
From my doSomething
function, I want to call my doSomethingElse
function. Right now, I am calling it in the success function of my HTTP request (yes, it is succeeding).
Once the success function triggers, I'm calling the other function like so:
angular.scope().doSomethingElse(data);
The data
variable is passed through as a parameter in the success function.
After running, I'm receiving this error: TypeError: undefined is not a function
Is there another way to do this?
Upvotes: 2
Views: 859
Reputation: 6486
You can just call $scope.doSomethingElse(data);
since you've already defined it as a function. As long as it is defined before you call it, this will work.
Upvotes: 3