M
M
Maxim2014-11-27 11:01:58
JavaScript
Maxim, 2014-11-27 11:01:58

Where did I make a mistake in the code?

orderList stores data from localStorage.
Anything starting with $scope.totalPrice doesn't work.

diskShop.controller('diskBasketCtrl', function($scope) {
    $scope.baskets = orderList;
    $scope.totalPrice = function($scope) {
        var total = 0;
        angular.forEach($scope.baskets, function(baskets) {
            total += baskets.Price;
        });
        return total;
    }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2014-11-27
@might

Why indulge in $scope in the totalPrice parameters if it is already visible?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question