Reputation: 5485
I am going through the angularjs from a couple of weeks, have reached the decorators, what i have understood is that, it will just decorate/modify the existing directive by addning or modifing the existing objects of directive,
My question is Why not we directly do the same in the directive itself in the first place, why we need to write a abstract directive, and then do config() the directive at later stage,
Any advantage of using this kind of Behavior?, When it will prove, it is worth Using the decorators.
NOTE: Since i am a learner, it may be a simple or silly point, but please do advice,
Upvotes: 0
Views: 86
Reputation: 9108
I don't believe you can decorate directives. Decorators are used to override or modify services. It is typically used to modify/enhance/replace/wrap 3rd party or upstream services that you don't own. The advantages are many, I'll list some that I can think of off the top of my head:
It is a powerful feature and opens many doors.
Upvotes: 1