Communication between controllers in Angular

后端 未结 3 1525
栀梦
栀梦 2021-02-03 12:28

I\'m familiar with the following methods to implement communication between controllers.

Are there others? Are there better approaches / best practices?


3条回答
  •  广开言路
    2021-02-03 12:56

    I use functionality-specific shared services to communicate between controllers.

    You can create a generic shared service to have a central point to subscribe to and broadcast events, but I find functionality-specific services to be easier to maintain over time, especially as the project and team grows.

提交回复
热议问题