devconcept / ng-shopping-cart Goto Github PK
View Code? Open in Web Editor NEW๐ An Angular component library to create shopping carts
Home Page: https://devconcept.github.io/ng-shopping-cart/
License: MIT License
๐ An Angular component library to create shopping carts
Home Page: https://devconcept.github.io/ng-shopping-cart/
License: MIT License
Hi, May i know how to use onItemAdded? Can you provide examples in documentation?
Angular version: major.minor.patch
8.0.0
NgShoppingCart version: major.minor.patch
1.0.0
Browser: Name, Platform, Version
Platform: Name, Version
Node version: major.minor.patch
12.0.0
In a brand new project with Angular and added ng-shopping-cart with npm, when import it says that aren't module or component of angular
It seems that there aren't the decorator for components and module in the npm package.
I use a SharedModule for exporting all the modules or component necessary for other Modules/Components, and i use the Lazy Loading of Modules.
In my SharedModule when i import ShoppingCartModule tslint says that:
Angular version: 9.1.12
NgShoppingCart version: 1.0.0
Platform: Windows 10
Node version: 12.4.0
If I add an item to the cart, then try to add a different quantity of the same item, the cart item's quantity is updated to the new quantity.
I would like to add to the quantity, not update.
eg I add an item to the cart. Then I add qty 2 of this item. I would expect to now have qty 3 in the cart.
How is this possible?
When we use the library with Angular Universal, Angular Universal doesn't work.
Angular version: 10.1.4
NgShoppingCart version: 1.0.0
Angular Universal failed because the use of window without check if is the browser or not.
Check if can use the variable window
Create an angular project with angular universal using this library.
Angular version: major.minor.patch
8.0.0
NgShoppingCart version: major.minor.patch
1.0.0
Node version: major.minor.patch
12.0.0
Is possible to see a loader in the components when the data are loaded from LocalStorage?
I use this to load the number of total item in cart this.cartService.itemCount()
but while the data are taken from LocalStorage i see nothing. Is possibile to show a loader or a placeholder in this fraction of time?
Angular version: major.minor.patch
7.2
NgShoppingCart version: major.minor.patch
1.0.0
Browser: Name, Platform, Version
Chrome 76.0.3809.100, Desktop
Platform: Name, Version
Windows
Node version: major.minor.patch
10.16
I'm not able to get the quantity of item and detect quantity when it changes.
It should return the quantity in numbers and also emit the changes
Angular version: major.minor.patch
8.0.0
NgShoppingCart version: major.minor.patch
1.0.0
Browser: Name, Platform, Version
Platform: Name, Version
Node version: major.minor.patch
12.0.0
I've added the library in my angular project and work fine, but when i refresh the page the items values in localstorage are resetted, but the item in the array remain.
I've imported the module in the app module with root.
Angular version: major.minor.patch
8.0.1
NgShoppingCart version: major.minor.patch
1.0.0
Platform: Name, Version Windows 10
Node version: major.minor.patch
12.4.0
Product prices are tax exclusive, ie the tax is added based on current tax rate when an item is added to the basket.
Also it is not possible to remove the tax rate entirely.
I would like to:
a) be able to hide the tax rate entirely in the cart-view (eg if not being used or zero rate), and
b) show the product prices as tax inclusive
Is this currently possible?
Hi, even though I have multiple items in my test project which I am adding to the cart, it seems to overwrite them each time so there is always only the latest item. I have included the relevant code below. (It doesn't make any difference whether I catch the item added event and explicitly write to storage via the service or not). I have queried the items array via the service and it only ever has one item in it. It also doesn't matter whether I use local or session storage.
HTML
CLASS
import { Component, OnInit } from '@angular/core';
import {Produce} from './models/produce';
import {BaseCartItem, CartService} from 'ng-shopping-cart';
@component({
selector: 'app-shop',
templateUrl: './shop.component.html',
styleUrls: ['./shop.component.css']
})
export class ShopComponent implements OnInit {
produceArray = [];
constructor(private cartService: CartService) { }
itemAdded($event) {
console.log('item added called. Item = ', $event );
const item = $event;
this.cartService.addItem(item);
const items = this.cartService.getItems();
console.log('Items in care = ', items );
}
getBaseCartItem(index: number){
const selectedProd = this.produceArray[index];
let baseCartItem = new BaseCartItem();
baseCartItem.image = selectedProd.pictureURL;
baseCartItem.data = selectedProd.measure;
baseCartItem.name = selectedProd.name;
baseCartItem.price = selectedProd.price;
baseCartItem.quantity = selectedProd.quantity;
return baseCartItem;
}
ngOnInit() {
this.produceArray = [];
const skinProd = new Produce();
skinProd.pictureURL = '../assets/cremeNight.jpg';
skinProd.quantity = 10;
skinProd.name = 'Night Cream';
skinProd.price = 9;
skinProd.measure = 'each';
this.produceArray.push(skinProd);
const maizeProd = new Produce();
maizeProd.pictureURL = '../assets/maizeFlour.jpg';
maizeProd.quantity = 4;
maizeProd.name = 'Maize Flour';
maizeProd.price = 15;
maizeProd.measure = '250g';
this.produceArray.push(maizeProd);
const potProd = new Produce();
potProd.pictureURL = '../assets/potatoPontiac.jpg';
potProd.quantity = 12;
potProd.name = 'Pontiac potato';
potProd.price = 7;
potProd.measure = 'kg';
this.produceArray.push(potProd);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.