I am facing an issue with getting this factory recognized in my other controllers so that I can inject a result object into them.
myApp.factory('resultService', function(){
function SampleService() {
this.result = [];
}
});
This code is from my controller, with some parts removed that are not relevant to the question.
myApp.controller('125Zero', ['$scope','ngAudio', function($scope, ngAudio, SampleService){
$scope.buttonPressed= function() {
var tempObj = {};
tempObj.title = $scope.title;
tempObj.frequency = $scope.frequency;
console.log(tempObj);
SampleService.result.push($scope.tempObj);
}
}]);
I am consistently getting a TypeError: Cannot read property 'result' of undefined.
I realize it might be a small mistake that I have overlooked.