var init = function(){
$scope.getAllFriends($rootScope.rootName)
.then(function(data) {
console.log(data);
}, function(err) {
//error
});
}
init();
$scope.getAllFriends = function(name){
return friendService.getAllfriends(name)
}
Am new to angularjs, am trying to call a function on page load but am getting below error. Can anyone correct me where am wrong.
TypeError: $scope.getAllFriends is not a function