I am new to Angular JS. Here is my problem. I am trying to create a factory. But when I call factory, it gives me an error -Error undefined is not an object (evaluation: myService.getProjects)
the code:
myApp.factory('myService', function() {
return {
getProjects: function() {
return "Test";
}
};
});
myApp.controller('homeController',['$scope',function($scope,myService)
{
$scope.projects=myService.getProjects();
$scope.message="homeController";
}]);
source
share