I need to get the total of the following example:
$scope.fees = {
basic: 1,
premium: 2,
total: this.basic + this.premium
}
Why won't this work? It says this
is undefined. Is there a way to achieve this without having to write out total: $scope.fees.basic + $scope.fees.premium
.
I'd love if there was a way to shorten it.
EDIT: I'd actually have to add the total
property outside of $scope.fees
. $scope.fees.total = ...