Reputation: 169
The code inside the controller is:
(function(){
$scope.show();
profile.friend_requests_to_me_service(loggedInUser.id).then(function(data){
console.log(data);
$scope.friend_requests_to_me = data.data.friend_request_to_me;
$scope.friends = data.data.people_you_may_know;
$scope.hide();
});
})();
As you can see this function is calling the service profile and a method of that service.The problem is that this invoking function is not working.The error is given:
TypeError: (intermediate value)(...) is not a function
.In plunker i have checked a trivial self invoking function.Here is the link:http://jsfiddle.net/Lvc0u55v/4582/.
This trivial self invoking function is working.But I cant understand why my actual app self invoking function is not working.Thank you for your time.
The present working version(non self invoking) is:
$scope.friendship_requests_to_me_function = function(){
$scope.show();
profile.friend_requests_to_me_service(loggedInUser.id).then(function(data){
console.log(data);
$scope.friend_requests_to_me = data.data.friend_request_to_me;
$scope.friends = data.data.people_you_may_know;
$scope.hide();
});
}
$scope.friendship_requests_to_me_function();
Upvotes: 0
Views: 791
Reputation: 1443
Most probably one of your js statement is missing a ';' at the end.
Try add a ';' before your self invoking function.
Read more here
We end up passing the second function as an argument to the first function and then trying to call the result of the first function call as a function. The second function will fail with a "... is not a function" error at runtime.
Upvotes: 1