I thought of having multiple directives: one for single-state icons; one 
for dual-state icons; and so on -- but then how do I tie them all back to a 
single controller?  I guess the obvious question is: why do I think I need 
only a single controller?  Things would be simpler if I mad tuples: 
directive+controller+service=singleStateActionIcon; 
directive+controller+service=dualStateActionIcon; and so on...

I like the idea of a container for these icons, that would let me manage 
them as a group, perhaps there will be a set of icons that don't live in a 
table cell.

These icons will be the users interface to initiate actions -- there are 
lots of different actions to take depending on what kind of entity is being 
listed in the table.

I'm using a service only to encapsulate the data structures and business 
logic that will represent the state of and action triggered by the icons in 
the row, which one should be shown with what tooltip, and what actions are 
taken when the icons are clicked and so on - there will be no server 
interaction directing the icon set after initial creation.  

I've seen many posts on wrapping business related logic in services to keep 
it out of the presentation layer (controllers, directives, etc) .  If an 
icon click causes a server action I'll be dealing with that through a 
resource via logic in some higher-level service elsewhere.  



On Tuesday, February 10, 2015 at 4:28:59 AM UTC-5, Sander Elias wrote:
>
> Hi Al,
>
> It sounds to me you need a few directives to handle this. An icon 
> directive to handle each icon on its own, and a sort of holder directive 
> that decides what to show, based on the data available in your row.
> I don't see how a service would help here, unless you need to do some 
> server requests based on the data. However, that's a bad idea, as that 
> would be a large performance hit.
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to