简体   繁体   中英

Ember Application controller to share data

In an Ember engine app, can an Application Controller be used to share data between

  1. Say parent app & child engine
  2. Between 2 child engines

So one of them would set the data/attribute on the Application Controller & other would access/get it from the Application Controller

Can that be done easily or is it better to use Services.

Generally a service is probably preferable. Controllers are singletons and have the ability to do what you are suggesting, but services are a simpler concept that was abstracted in Ember as the community began realizing what they were using controllers for. At some point, some of that controller functionality may go away too ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM