0

I am facing problem in representing ng-repeat in template for custom directive compilation. Please find my plunker http://plnkr.co/edit/5A5oZf5kwBezB4mqZ56C?p=preview. Here even though the question is appearing but the options are not appearing. I am doubting whether my following code in the template formation is correct or not?

<div ng-repeat="Option in {{curQuestion.Options}}">
smart987
  • 834
  • 2
  • 14
  • 34

1 Answers1

1

No need for double curlies inside an ngRepeat expression.

<div ng-repeat="option in curQuestion.options">  
    <label for="option.Id" ng-click="onSelect(Option);">   
         <input id="option.Id" type="checkbox" ng-model="option.Selected" />
                 {{option.Name}}  
    </label>   
</div>

Double curlies are used for binding the view to the model (telling angular that "option.Name" is not really just plain text but a scope variable).

Inside an "ng-something" attribute - you're basically in the model already, that's why

{{option.Name}}

Is equivalent to

<span ng-bind="option.Name"></span> 

Anyway, here's a plunker.

Daniel
  • 6,194
  • 7
  • 33
  • 59