15
Lepszy sposób na sumowanie wartości właściwości w tablicy
Mam coś takiego: $scope.traveler = [ { description: 'Senior', Amount: 50}, { description: 'Senior', Amount: 50}, { description: 'Adult', Amount: 75}, { description: 'Child', Amount: 35}, { description: 'Infant', Amount: 25 }, ]; Teraz, aby uzyskać całkowitą kwotę tej tablicy, robię coś takiego: $scope.totalAmount = function(){ var total = 0; …