Kemal P. Kemal P. - 1 year ago 52
AngularJS Question

TypeError: Complaint.get is not a function

Im getting this error:

TypeError: ComplaintData.get is not a function

Could somebody tell me please why it's showing that error? What could cause this error? The service is injected into the controller but i dont know what could be causing the error.


(() => {

.controller('complaintController', complaintController)

complaintController.$inject = ['$http', '$rootScope', 'Complaint']

function complaintController($rootScope, Complaint) {

var vm = this;
vm.array = [];

.success((info) => {
vm.array = data
.error(() => {
$scope.error = data


(() => {
.service('Complaint', complaintInfoService)

function complaintInfoService($http) {

function getInfo() {
return http.get('/user/info/')

function createComplaint(data) {
return $'/user/complaints', {data: data})

return {
get: getInfo,
create: createComplaint


Answer Source

on your controller you forgot to declare the $http variable

function complaintController($http, $rootScope, Complaint) //add $http in front

now you are trying to access the get method from $rootscope