Hello! Guys, please tell me - which article [or articles (:) smoke to fully understand. Or which sections to pay attention to in the documentation. The crux of the matter is in the transfer of data between modules in AngularJS.

if more detail:

I make my first test application in the form of a store, I need to implement authorization on it. The application itself is divided into several separate components, each with its own controller. Those. There is for example a page with a product - all this is in a separate view, with its own separate controller - as a component.

It is necessary to make the logged-in user visible in all views, for example, he clicks on the product - it is added to the basket, goes to the basket - sees the list of products that clicked, clicks to pay - and the purchase amount is deducted from the corresponding field of the fake object.

I thought to implement all this through a global controller, to the main module, which for example would be registered in the body, but for some reason the idea does not seem good :)

  • one
  • And why? I always imagined that each application implements a separate module, and everything else — authorization, forms, shopping cart, etc. — are separate controllers, and data, for example, an authorization token, is exchanged via rootScope. - Andrei Talanin

0