I have this as serices.js in my angular app
angular.module('services', [])
.factory('studentService', ['$http', function($http){
return{
getStudentDetail: function(callback, pid){
$http.get('/api/student/'+pid+'/?format=json').success(function(data) {
// prepare data here
callback(data);
});
}
};
}]);
and this is in my controller
studentService.getStudentDetail(function(data, pid){
$scope.student = data;
});
It's hard to tell what the problem is here, you haven't really asked a question or described your problem. But from the looks of it, this:
studentService.getStudentDetail(function(data, pid){
$scope.student = data;
});
should be:
studentService.getStudentDetail(function(data){
$scope.student = data;
}, pid);