so I have this in my index.html:
<!-- Nav -->
<nav ng-init="cartempty=true" id="nav">
<span ng-if="!cartempty">
<i class="fa fa-shopping-cart"></i>: {{total}}
</span>
<span ng-if="cartempty">
<i class="fa fa-shopping-cart"></i>: Cart Empty
<i class="fa fa-frown-o"></i>
</span>
</nav>
When somebody adds to the cart, I want cartempty to go false.
I was trying to do this in the controller, off an ng-click that launches the plusOne function, but it wasn't working...
$scope.plusOne= function(theBread, theNumber) {
cartempty = false;
function searchandreplace(nameKey, myArray){
for (var i=0; i < myArray.length; i++) {
if (myArray[i].text === nameKey) {
myArray[i].quantity = theNumber;
}
}
}
searchandreplace(theBread, $scope.BreadsToOrder)
}
Is it a scope issue? How do I do this properly?