0
request = myService.getCases();
request.then(
function(payload) {
$scope.cases = payload.data;

var time =  Math.floor((Date.now() - Date.parse($scope.cases[i].date_case_modified))/(60000*60*24));

$scope.cases.duration.push(time);
}
});

Inside the controller I am trying to tack on the cases.duration onto the cases object but it wont add it onto the object that is returned. Any ideas?

1
  • What is the type of duration? Commented Jan 30, 2015 at 17:46

1 Answer 1

1

I think you just need to introduce a forEach as shown here:

request = myService.getCases();
request.then(
    function(payload) {
         $scope.cases = payload.data;

         angular.forEach($scope.cases, function (el) {
            var time =  Math.floor((Date.now() - Date.parse(el.date_case_modified))/(60000*60*24));

            el.duration = time;
        });
    }
});

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.