February 2015
Intermediate to advanced
232 pages
4h 40m
English
Services are also singletons, like resources, so follow the same steps as the resources module:
services/ProductService.js file.var Shop;
Shop = Shop || {};Resources namespace:Shop.Services = Shop.Services || {};ProductService:Shop.Services.ProductService = (function(){
})();services/ProductService.js file. Since in the application the resources are singleton, extend the resource with the methods used in the following code:var Shop; Shop = Shop || {}; Shop.Services = Shop.Services || {}; Shop.Services.ProductService = (function(Product) { var hasStock = function (product) { return product.stock() ...Read now
Unlock full access