ng:repeat item renderers

127 views
Skip to first unread message

Luke Bayes

unread,
Apr 3, 2012, 8:15:44 PM4/3/12
to ang...@googlegroups.com
Hey Folks,

We've been working with Angular for awhile now, and one of the things we've been missing from other app environments, is the idea of an "item renderer".

This is a custom component that is selected at run time based on the data in a collection.

We just worked through some ideas today and thought we'd share the results.

   http://jsfiddle.net/VSzCN/4/

This example is slightly more complicated than it should be, because our use case involves selecting different list renderers, and then selecting different cell renderers within the lists.

FWIW - we started out by using ng:switch statements, but they turned out to be overly complex and required a code change in multiple places whenever we added a new template/widget.


There may be a better way to solve this problem, so any feedback is welcome.

Thanks,

Luke

Peter Bacon Darwin

unread,
Apr 4, 2012, 2:25:49 AM4/4/12
to ang...@googlegroups.com

I am doing something similar in my questionnaire app: https://github.com/petebacondarwin/questionnaire-angular/tree/master/app
In this I use the type of question to load the relevant template in an include directive. See the QuestionController and question.html template
Pete

...from my mobile.

On Apr 4, 2012 1:16 AM, "Luke Bayes" <lba...@google.com> wrote:
Reply all
Reply to author
Forward
0 new messages