0

I've currently set this :

  $scope.privates = [
    {value:'Private'},
    {value:'Public'}
  ];

And in my view I do this :

%h2 Etablissement
  %div{"data-ng-repeat" => "private in privates"}
    %input{"data-ng-model" => "filterPrivacy[private.value]",:type => "checkbox"}
      {{private.value}}

And currently it renders this :

        <h2>Etablissement</h2>
        <div data-ng-repeat-start='private in privates'>
          <input data-ng-model='filterPrivacy[private.value]' type='checkbox'>
        </div>

the {{private.value}}isn't showing up anywhere and I should have two inputs cause I've got two values. What am I missing ? Cordially, Rob

P.S : When I test {{privates}} it renders this to me

<div ng-repeat='private in privates'>
   [{"value":"Private"},{"value":"Public"}]
</div>
4

1 回答 1

1

您呈现的代码中存在问题,应该使用data-ng-repeat而不是data-ng-repeat-start,如果您仅更改这部分,它可以完美运行:http: //jsfiddle.net/jjFzv/1/

如果你想使用data-ng-repeat-start我认为你还应该包括一个data-ng-repeat-end

我还在控制器中初始化了$scope.filterPrivacy={};,但我认为你做到了,这不是主要问题

使用 data-ng-repeat-start/end 它呈现如下:http: //jsfiddle.net/jjFzv/3/
玩得开心

于 2013-09-03T15:56:51.913 回答