In my Angular project, I have implemented a basic logging service:
app.service('$userInteraction', [function() {
var userLog = "";
this.log = function (datetime, screen, logMessage) {
userLog.concat(datetime + "\t" + screen + " Screen\t" + logMessage + "\n");
}
this.getLog = function () {
return userLog;
}
this.clearLog = function () {
userLog = "";
}
}]);
Within one of my controllers, I make use of this logging service like this:
app.controller('myController', ['$scope', '$userInteraction', function($scope, $userInteraction) {
$userInteraction.log(Date(), 'Login', 'Some random message.');
}]);
However, upon running the code, I encounter the following error:
TypeError: $userInteraction.log is not a function
I could have sworn that it was working correctly before. Being new to Angular, this might be due to a rookie mistake on my part. Any help would be greatly appreciated!