Reputation: 1064
This is module and controller code
var app = angular.module('apApp',[]);
app.controller('apCtrl', ['$scope','$http','getPopByBranch',function($scope, $http,getPopByBranch)
{
$scope.greeting = 'Hola!';
console.log(getPopByBranch.test) ;
}]);
var boot_apApp = document.getElementById('apApp');
angular.element(document).ready(function() {
angular.bootstrap(boot_apApp, ['apApp']);
});
This is my service code saved in separate js file
angular.module('apApp').factory('getPopByBranch', function($http){
var pops = {};
pops.test = function(){ return "Hello";};
//i want value of second function also
//pops.test = function foo(){ return "Bye";};
return pops;
});
output in console
function(){ return "Hello";}
The problem is that i want only hello or some value returned .
Upvotes: 1
Views: 25
Reputation: 28445
You need to call the function. Update from
console.log(getPopByBranch.test);
to
console.log(getPopByBranch.test());
Upvotes: 1