snapjay / ngCart

Really simple shopping cart for AngularJS
http://ngcart.snapjay.com
380 stars 236 forks source link

setQuantity() doesn't return the quantity as it written in documentation #57

Open morwin10 opened 8 years ago

morwin10 commented 8 years ago

So I fix it so :


item.prototype.  = function(quantity, relative){

            var quantityInt = parseInt(quantity);
            if (quantityInt % 1 === 0){
                if (relative === true){
                    this._quantity  += quantityInt;
                    return this._quantity; // fix 
                } else {
                    this._quantity = quantityInt;
                    return this._quantity; // fix
                }
                if (this._quantity < 1) this._quantity = 1;

            } else {
                this._quantity = 1;
                $log.info('Quantity must be an integer and was defaulted to 1');
            }