I have two javascript files separately and I want to get one from the other. So, I created a factory module as shown below:
var module = angular.module('test',[]);
module.factory('$result', function() {
var data = {something:"somewhere"};
return data;
});
and I want to call from another file. At the moment, I have stopped below:
var module = angular.module('myApp', ['test']);
module.controller('NearestController', function($test) {
console.log(test);
});
What part of me is doing wrong? help me and I'm new to angular
source
share