I have two separate javascript files and I am trying to retrieve one from another. To achieve this, I have created a Module factory as shown below;
var module = angular.module('test',[]);
module.factory('$result', function() {
var data = {something:"somewhere"};
return data;
});
Now, I want to call it from another file. Currently, I have set it up like this;
var module = angular.module('myApp', ['test']);
module.controller('NearestController', function($test) {
console.log(test);
});
Could you please help me identify what I might be doing wrong? I am new to Angular and would appreciate any guidance.