直接上代码
html:
<div class="input-group" >
<span class="input-group-addon">地区</span>
<div class="btn-group" bs-checkbox-group="">
<label class="btn btn-default" ng-repeat="movie_zones in movie_zone_lists">
<input type="checkbox" checklist-model="mzone" checklist-value="movie_zones.code">
{{movie_zones.country_zone}}
</label>
</div>
</div>
控制器里的代码:
$scope.mzone = ‘‘;
$scope.create_program_vod = function () {
$scope.program_vod.type = ‘vod‘;
console.log($scope.program_vod);
$scope.program_vod.movie_genre = $scope.genreCode[0];
$scope.program_vod.country_zone = $scope.mzone;
cmsprogram_model.$build($scope.program_vod).$save();
};
这样的话在控制器里取不到html里的值,也就是$scope.mzone 值为‘’(空)
如果$scope.mzone = ‘‘ 改为 $scope.mzone = []
$scope.program_vod.country_zone = $scope.mzone改为 $scope.program_vod.country_zone = $scope.mzone[0]
这样才能取到值
原因可能在于html中的<div class="input-group" >,因为这是一个输入组,因此存放其值的变量也因为数组