I'm a newbie on angularjs so I have a question for you. In my "standard html template" I have some html for the shopping cart summary, this html is on all the pages (like a popup to manage the cart quickly). So I was thinking to use a shared contoller to handle the common html pieces, something like:
app.controller ('SharedCtrl', function ($ brooms, cartService) {
...
$ scope.cart = myBagService.get(); // get items from local store
$scope.removeCartItem = function(key){
myBagService.remove(key){..}; //remove stored item
myBagService.add(item){..}; //store item
$scope.cart = myBag.get(); //update binding items
}
...
}
Is this a correct way to accomplish this task? if yes, how I can call the above methods from other controllers ? for example on the product detail page I have to call the add method.