I am currently working on an Angular app where I am passing a named function into a controller. The issue arises when I try to inject a provider into that controller for use, as I receive a
TypeError: object is not a function
in the console.
My question is, what could be potentially causing this error? Am I approaching this problem from the wrong angle?
(function() {
'use strict';
angular.module('MyCoolApp.controllers')
.controller('SignInCtrl', ['$scope', 'Avatar', SignInCtrl]);
function SignInCtrl(Avatar) {
var vm = this;
// The error seems to occur when trying to create an instance of Avatar
vm.avatar = new Avatar();
}
})();