I got an error TypeError: Cannot read property 'success' of undefined
when using $http and my custom service.
My app.js :
app.controller('AppCtrl', ['$scope', '$http', 'topicContent', function($scope, $http, topicContent){
topicContent.request().success(function(data){
$scope.threadContent = data;
console.log(data);
});
}]);
app.factory('topicContent', ['$http', function($http){
var query = function() {
return
$http({
url: "http://www.corsproxy.com/daysof.me/lowyat/thread.php",
method: "GET"
});
}
return {
request : function(){
return query();
}
}
}]);
This is so strange, I couldn't find any flaw of it.