如何使用 icheck 插件在 angularjs 中的控制器上传递复选框值
How to pass the checkbox value on controller in angularjs using icheck plugin
嗨,我是 Angular js
的新人。
我在前端使用 Icheck
插件进行 checkbox
设计 end.In,但我无法从前端获取 checkbox
值。
<input type="checkbox" ng-model="createLeaveTypeForm.allow_encashment" name="allow_encashment" class="flat" >
<span style="margin-left: 5px;">Allow Encashment</span> </label>
如果我使用 $scope.createLeaveTypeForm.allow_encashment
获取值,它会显示 undifinded.Anyone 指导我实现此目标。
提前致谢。
您需要初始化复选框范围值,初始化范围类似于下面的默认未选中;
$scope.createLeaveTypeForm.allow_encashment = false;
默认选中
$scope.createLeaveTypeForm.allow_encashment = true;
嗨,我是 Angular js
的新人。
我在前端使用 Icheck
插件进行 checkbox
设计 end.In,但我无法从前端获取 checkbox
值。
<input type="checkbox" ng-model="createLeaveTypeForm.allow_encashment" name="allow_encashment" class="flat" >
<span style="margin-left: 5px;">Allow Encashment</span> </label>
如果我使用 $scope.createLeaveTypeForm.allow_encashment
获取值,它会显示 undifinded.Anyone 指导我实现此目标。
提前致谢。
您需要初始化复选框范围值,初始化范围类似于下面的默认未选中;
$scope.createLeaveTypeForm.allow_encashment = false;
默认选中
$scope.createLeaveTypeForm.allow_encashment = true;