ng-repeat to directive - binding does not seem to work

200 views
Skip to first unread message

Jason Perry

unread,
Oct 23, 2012, 3:37:37 PM10/23/12
to ang...@googlegroups.com
I've created a survey element that displays a title and tracks a set of button as if they are radio buttons.

When I use the survey directly everything works
<survey title="BASIC CALIBRATION OF ANALOG DEVICES" rating="3"/>

But when I do something like:
<survey ng-model="items" ng-repeat="item in items" title="{{survey.title}}" rating="{{survey.rating}}"></survey>
It doesn't.

I have an example up here:  http://jsfiddle.net/jbperry/bEqDy/

Eventually I would want to pull in the items list from a json file, and persist the results back to disk.  But for now, this has me stumped.

My first foray into angularjs, and I'm enjoying it, but parts of it seem to have a steep learning curve.

Peter Bacon Darwin

unread,
Oct 23, 2012, 4:03:11 PM10/23/12
to ang...@googlegroups.com
Try this: http://jsfiddle.net/bEqDy/5/

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
 
 

Jason Perry

unread,
Oct 23, 2012, 4:04:24 PM10/23/12
to ang...@googlegroups.com
Sorry, the way I wrote that second example should be 
<survey ng-model="items" ng-repeat="item in items" title="{{item.title}}" rating="{{item.rating}}"></survey>

Corrected in jsfiddle as well.

But still does not work.

Jason Perry

unread,
Oct 23, 2012, 4:06:11 PM10/23/12
to ang...@googlegroups.com
Ahhhhh!!!!!  

You're a genius.

Thanks!

Jason Perry

unread,
Oct 23, 2012, 4:12:50 PM10/23/12
to ang...@googlegroups.com
That was a quick fix!  Thanks!

I'm still trying to get my head around the levels of scope and when you use the various modifiers like @ and &.

Not sure I'm getting it yet.  Need to pound it in with a few more example projects I guess.
Reply all
Reply to author
Forward
0 new messages