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?
angularjs
Ryan.c
source share