Task:
- To show contact.
- Contact is JSON data, let's say {name: Mark, location: England, phones: [...]}.
- Contact could be shown in multiple ways: compact / detailed / enhanced with additional info (shared contacts - additional directive)
Because contact could be shown on different pages in different places it's naturally to create directive (widget) for contact, but here is question: How to organize same widget with multiple templates?
Options:
- Create one directive with one template, that hides sections
according to contact type - big template with possibly a lot of
ng-switch and ng-if - Create directive for each template - almost
same directives with only different template (or templateURL) - To
load templates dynamically while linking - has problems with
transclusion and replacing (merging attributes)
Whats your expirience with solving these problem?