0
avanekar02 created
Brother i need to create a service as below in the app.js so that it can be accessed by multiple views, do you recommend this reason is to create s shopping cart or if you have some other method please advise
storeApp.factory("DataService", function () {
// create store
var myStore = new store();
// create shopping cart
var myCart = new shoppingCart("AngularStore");
// enable PayPal checkout
// note: the second parameter identifies the merchant; in order to use the
// shopping cart with PayPal, you have to create a merchant account with
// PayPal. You can do that here:
// https://www.paypal.com/webapps/mpp/merchant
myCart.addCheckoutParameters("PayPal", "[email protected]");
// enable Google Wallet checkout
// note: the second parameter identifies the merchant; in order to use the
// shopping cart with Google Wallet, you have to create a merchant account with
// Google. You can do that here:
// https://developers.google.com/commerce/wallet/digital/training/getting-started/merchant-setup
myCart.addCheckoutParameters("Google", "500640663394527",
{
ship_method_name_1: "UPS Next Day Air",
ship_method_price_1: "20.00",
ship_method_currency_1: "USD",
ship_method_name_2: "UPS Ground",
ship_method_price_2: "15.00",
ship_method_currency_2: "USD"
}
);
// return data object with store and cart
return {
store: myStore,
cart: myCart
};
});
1 Answer(s)
-
0
I think it's just fine. You can create such a shared service in your angularjs application.