2016-12-16 39 views
0

由於某種原因,ng-model="episodeValue"沒有綁定到表單對象。它是<form>的子女。任何想法爲什麼?如果可能的話,我想保持原始。複選框輸入ng-model沒有綁定到表單對象

   <label> 
       <input type="checkbox" 
       ng-model="episodeValue" 
       ng-required="true" 
       ng-change="episodeCheckbox(initialNewGoalForm)"/> 
       by the end of episode 
       </label> 

$scope.episodeCheckbox = function(episodeValue) { 
    console.log(episodeValue) 

回答

0

似乎沒有name屬性不會綁定到表單控件。

修復是name="episodeValue"

   <label> 
       <input 
        type="checkbox" 
        name="episodeValue" 
        ng-model="episodeValue" 
        ng-required="true" 
        ng-change="episodeCheckbox(initialNewGoalForm)"/> 
       by the end of episode 
       </label> 
相關問題