1
http://jsfiddle.net/ADukg/2644/NG-模式没有得到默认值复选框
为什么在我的每一个过滤器的“检查”我的默认值没有得到在页面加载的复选框设置?
我正在使用batarang进行调试,看起来模型正在更新,当我点击复选框时,但'checked'的默认值为true看起来不像它的应用。
它似乎工作,如果我使用ng-checked =“filter.checked”,但我不知道为什么。
JavaScript的:
$scope.filtersList = [
{"name":"type","checked":"true","label":"Source(s)","CSSClasses":"",
"values":[
{"key":"Online News","value":1,"parent":"false","children":[],"checked":"true"},
{"key":"Twitter","value":15,"parent":"false","children":[],"checked":"true"}]
},
HTML:
<div class="filter-listing" ng-controller="sidebar">
<ul class="filterSection" ng-repeat="filter in filtersList">
<li class="clearfix">
<span class="pull-left">
<a class="pull-left twistdown filterToggle"
href="#" title="Expand" data-toggle="collapse"
style="margin-top: 6px">
<i class="icon-white icon-plus-sign"></i>
</a>
<input type="checkbox" ng-model="filter.checked" id="filter.name" class="parentCheckbox allFilterCheckbox"/>
<label
style="display: inline;" for="filter.name">
{{filter.label}}
</label>
不能相信我错过了。我实际上已经通过调用服务器来填充这个数组。谢谢。 – leshow 2013-05-07 15:43:22