checklist-model
checklist-model copied to clipboard
checklist-model not working when ng-if is used on the same element
HTML
<div ng-repeat="obj in objects">
<input type="checkbox" ng-if="form.condition" checklist-model="form.model" checklist-value="obj.id" > {{ obj.title }}
</div>
JS
$scope.form = {
condition: true,
model: null
};
$scope.objects = [ {id:1, title: '1'}, {id:2, title:'2'}, {id:3, title:'3'} ];
This makes checklist-model attr disappear when looking in generates source, and model changes are not filled in properly. It can be fixed by putting the ng-if in the parent element. Apparently something with scope/linking isn't clicking?
Could you please prepare a JSFiddle or Plunker example? Thanks!
Sorry. I've provided all the information you need.
If you prepare a test case, a JSFiddle or Plunker example, it would help in solving the issue and find a fix much faster. Otherwise, it could take a while until I do this myself. Thank you.
I created a jsfiddle and I can reproduce the issue: http://jsfiddle.net/beradrian/3gwomn97/. I will work on it.
I've reproduced the same issue with ng-switch
Same issue here. My solution was wrap the input element with a div, and use ng-if in the div
Please fix this bug!
Any news on this issue?
As told by @leskeg, the issue gets resolved by moving ng-if condition to a wrapper. can be verified at this: http://jsfiddle.net/3Lbx453u
@sebastian-zarzycki u can solve this problem by use checklist-model="$parent.form.model" instead of checklist-model="form.model";because when u use "ng-repeat" a new $scope is created and it can't get the current form obj .