2017-01-16 41 views
0

我可以將選中的值與其他值一起插入到Db中。在此我試圖顯示從DB獲取的值。面臨的問題是,我想要選定的值複選框進行檢查並顯示其他值,我不能這樣做。任何人都可以幫助我如何去做。我附加了一個plunker如何我目前的屏幕看起來像。如何使用檢索的數據檢查複選框

HTML:角JS的

<body ng-controller="MainCtrl"> 
    <table> 
    <tr ng-repeat="field in fields" name="slotSelection"> 
    <td align="center"> 
     <input type="checkbox" ng-model="field.checked">{{field.name}} 
    </td> 
    <td> 
     <select ng-model="time" ng-options="time for time in field.timeslots"> 
     <option value="">select</option> 
     </select> 
    </td> 
    <td> 
     <input type="text" ng-model="interval" ng-blur="setTimeSlots(interval, field)"> 
    </td> 
    </tr> 
    </table> 
</body> 

Code in Plnk

回答

0

使用ngChecked選項

<input type="checkbox" ng-checked="*expression*"> 

如果表達是truthy,則檢查屬性將被所述元件

上設置
<input type="checkbox" ng-checked="field.checked">{{field.name}} 

Sample Plnkr

+0

它不是幹活:( – user7397693

+0

請檢查field.checked返回一個布爾值。我已經添加了示例plnkr的答案。請檢查。 –

相關問題