AngularJS best approach: data management or event?

AngularJS is famous for "3d": data binding, dependency injection and directives. Since data binding is such a kind of angularJS application, I always believe that data management is the best approach when deciding how the application works.

For example, if I want to answer some property updates, I will look at this property and write callback functions for it. And if I can use angularJS correctly, then $ apply is not required, and two-way data binding will automatically do the magic with big digest cycles.

However, in jQuery or in many other JavaScript libraries, event management seems to be so common that people always think that this is the client side. On the other hand, the event-related approach in angularJS means that I need to highlight or highlight events that are passed through / directives / controllers to pass events here and there. This is somehow different from a data-based approach.

My idea is event driven, which makes it difficult to debug, understand, and support the entire application. The only reason I use it is that it is easy to transfer data by area when the nested areas themselves are too complex for this.

Any idea on this? When should we stick to data, and when should we use an event? What is the best approach overall?

+7
angularjs
source share

No one has answered this question yet.

See related questions:

4523
"Thinking in AngularJS" if I have jQuery background?
3178
AngularJS: Service vs provider vs factory
1690
How does data binding work in AngularJS?
1195
How do I access the $ scope variable in the browser console using AngularJS?
1080
What is the best way to conditionally apply a class?
1073
How to use $ scope. $ Watch and $ scope. $ Apply in AngularJS?
912
'this' vs $ scope in AngularJS controllers
169
AngularJS - $ destroy remove event listeners?
155
AngularJS: the right way to bind to service properties
59
AngularJS: What is the best way to bind to a global event in a directive

All Articles