Yes because you are not adding items to your $localStorage.items and cart variables but every timeyou are assigning them completely new values to it every time and so it lost the last added values. You are re-initializing them everytimeevery time and so they loose last added values.
You should do something like this
if ($scope.cart != 0) { // instead of this //$localStorage.items = $scope.cart; // you should do this for(var i=0; i<$scope.cart.length; i++) { $localStorage.items.push($scope.cart[i]); } }