我正在尝试根据网格的列值初始化模型值。我有这个对象,我想用ng-init初始化它。但是当我在ng检查器中看到,模型值总是未定义的。AID是剑道网格中的动态值。
<input type="checkbox" ng-init=""obj['#: AID#']='Y'"" ng-model=""obj['#: AID#']"">
控制器:
var testController = function($scope){
$scope.obj= {};
}
下面是最终标记的样子
<input type="checkbox" ng-init="ps['test']=('Y' == 'N')" ng-model="ps['test']" class="ng-pristine ng-valid ng-touched">
我期望模型ps‘’test‘是假的。但它总是未定义的。请帮帮忙
发布于 2015-03-25 18:01:57
尝试将值设置为true或false,而不是Y或N。如下所示
<input type="checkbox" ng-init="obj['m']=true" ng-model="obj['m']">
https://stackoverflow.com/questions/29251815
复制相似问题