I have written a directive to achieve certain functionality. Now the scenario is that I need to add more varieties of that functionality. More varieties means the same functionality but there will be a few changes to the view/behavior.
How can I re-use the directive to achieve the above scenario. Do I have to create a separate directive for each variety?
After exploring from various sources, I have the following scenarios in my mind,
- Create separate directive for each variety.
- Group the common functions into a controller and use it for all the directives.
- Do the directive specific changes in link function.
Is the above approach fine, or am I missing something here?