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