I get undefined whenever I get the value of a property of an object.
function run(id){
   var report = services.getReportInfo(id);
   var childReport = {
       id: newGuid(),
       parentId: report.id, // i get undefined
       reportPath: report.path  // i get undefined
   };
   ...
}
services.js
angular.module('project.services').factory('services', function(){
   var reports = [
      {
         ....
      },
      {
         ....
      }
   ];
   function getReportInfo(id){
      var report = reports.filter(function(element){
          return element.id === id;
      });
   };
   return{
      getReportInfo: getReportInfo
   };
}
Whenever I put breakpoint on my var report = services.getReportInfo(id) it could contains the correct values for each property of the my report object. However, when I get the report.id or report.path, I get undefined value.
--Edited--
Oh, I know now where I got wrong.
The getReportInfo function returns an array and I'm accessing the properties without telling from what index should it get the values for the said properties.
function run(id){
    var report = services.getReportInfo(id);
    var childReport = {
       id: newGuid(),
       parentId: report[0].id,
       reportPath: report[0].path 
    };
    ...
}
I placed static index 0, since I know that the array will always have a length of 1.
 
     
     
    