Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="FirstCtrl">
Primeiro Controller: {{job}}
</div>
<br><br><br><br>
<div ng-controller="SecondCtrl">
Segundo Controller: {{job}}
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.factory('myService', function() {
return {
data:[{id:1,content:''},{id:2,content:''},{id:3,content:''},{id:4,content:''},{id:5,content:''},{id:6,content:'Restante Objecto...'},{id:7,content:''},{id:8,content:''},{id:9,content:''},{id:10,content:''}],
result:{},
filterById:function(id){
var that = this;
that.data.forEach(function(item){
if(item.id===id){that.result=item;}
});
}
};
});
function FirstCtrl($scope,myService) {
var RouterParamsId = 6;
myService.filterById(RouterParamsId);
$scope.job = myService.result;
console.log()
}
function SecondCtrl($scope,myService) {
$scope.job = myService.result;
}