So I have a shoppig cart project from school, when I checked the checkbox 
of ad-ons product it will plus the value in cart and its working, now my 
problem is when I unchecked the checkbox it's still adding and checked it 
will add again. I want is when I checked the checkbox is it will add then 
when I unchecked it will remove thae that I add.
I tried this

 <input type="checkbox" id="{{p.productName}}" ng-checked="defaultCheckState"  
ng-click="serviceAddOn(p);" />

 also this

  <input type="checkbox" id="{{p.productName}}" ng-checked="defaultCheckState" 
ng-true-value="serviceAddOn(p);" ng-false-value="Clear"/>


angular code

  $scope.IsSavingAddOn = false;
    $scope.serviceAddOn = function (product) {
    $scope.IsSavingAddOn = true;
    $scope.total = $scope.qty * product.priceValue;
    //AddToCartService.AddToCart(product.productId, 'Service', $scope.qty, 
product.priceValue, $scope.total, true);
    $http.post("/Home/AddCart?productid=" + product.productId + 
"&subs=Service&qty=" + $scope.qty + "&unitprice=" + product.priceValue + 
"&amount=" + $scope.total)
        .then(function (response) {
        }).finally(function (response) {
            $scope.$emit('CountCartEvent');
            $scope.IsSavingAddOn = false;
        });
};




-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to