0
我是新手与AngularJs和,复选框设置模型值不变
我特林让与$资源形式的项目,
我没有anyideas得到多个复选框值,并将其设置
来模型,但有一个错误显示我的复选框的值为空从
服务?
这里是我的代码
<dd ng-repeat="user in User.user" >
<input name="userName[user.userId][]" type="checkbox" ng-model="newProgram.program.managerId"
value="{{user.userId}}" check="model" />
{{user.userUsername}}
</dd>
angular.module('elnApp')
.directive('check', function() {
return {
require: 'ngModel',
scope: { model: '=check', value: '@' },
link: function(scope, elm, attr, ngModelCtrl, $filter){
elm.bind('click', function() {
scope.$watch('newProgram.program.managerId', function (value){
if(value == true){
var checkValue = scope.value;
var brands = [];
brands.push(checkValue);
ngModelCtrl.$setViewValue(brands);
scope.$apply();
}
});
});
}
}
});
我很困惑的是,任何人的想法?
你可以把一个jsfiddle或plunker放在一起吗?我对你想做什么感到困惑。 –
你想让你的指令完成什么? – Galdo
我正在做形式,并获得形式价值服务 – user2680731