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();