How could I combine those two codes in order to make that system good 
working:

cart: any[] = [];
public cart = JSON.parse(localStorage.getItem('cartItems'));

It should automatically check if the array is empty and if not, the codes 
would be automatically parsed from localstorage. 

-- 
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