Passing Data Between Controllers in Angular JS

We can share data between two or more controllers using service or factory. Example: First, I am creating a product service. myApp.service(‘productService’, function() { var product = [], addProduct, getProductList, removeProduct; addProduct = function(obj) { product.push(obj); }; getProductList = function(){ return product; }; removeProduct = function(id { product.splice(id, 1); }; return { addProduct: addProduct, removeProduct: […]

Continue reading