hey friends,
i m developing shopping app in ionic and i m new in ionic frmework,
my problem is i m creatin shopping cart and checkout and want to get item in my cart, but i can’t understand how to do…
so please suggest me.
hey friends,
i m developing shopping app in ionic and i m new in ionic frmework,
my problem is i m creatin shopping cart and checkout and want to get item in my cart, but i can’t understand how to do…
so please suggest me.
Hi Ashish,
What your looking for is an angular service. This will allow you to persist data across the application.
yes, i know but i don’t understand how to implement shopping cart and how to add and remove items in my cart.
So something like this :
.service('shoppingCart', function() {
var shoppingList = [];
this.addItem = function(item){
this.shoppingList.push(item);
};
this.deleteItem = function(item) {
// Remove an item from the list here
};
// etc
});
Thanks Dear,
i have solve my problem.
i solve shopping cart problem but one another problem is also accoutre.
this is dependency problem. i m create sidemenu app so services.js (file) is not by default not created so, i never be set dependency. i m also set link in index.html and i m declare dependency in app.js.
like. - angular.module(‘starter’, [‘ionic’, ‘starter.controllers’, ‘starter.services’])