I have been reading wrox angular book. Inside the book the author describes that a method of sharing data between controllers is to
- Have a property on the root scope
- Update that property on the root scope
- Broadcast the fact that the property was updated
- All children scopes that need to know , will listen for the broadcast.
as opposed to expose an object on a Service and letting angular's two way databinding do all the heavy lifting. Why would anyone go with the 'root scope publish/subscribe' methodology, instead of exposing an object on the service?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…