This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
orderBy same property as ngModel throws $digest error #10014
Closed
Description
When I try to orderBy a property that I am binding to in a ng-repeat
I get a $digest
error.
I think it is occurring because in one digest the ng-model
value is updating, which effects the parents orderBy
clause. I do not know how to get around this.
Plunker
This shows the issue occurring. Be sure to open the console!
http://embed.plnkr.co/rGLagq/preview
JS
var options = [
{
name: 'test',
isSelected: true
},
{
name: 'another test',
isSelected: false
}
];
HTML
<div ng-repeat="option in options | orderBy:'-isSelected'">
<label>
<input type="checkbox"
ng-model="option.isSelected"> {{option.name}}
</label>
</div>
Error
Error: [$rootScope:inprog] $digest already in progress
Other
Original StackOverflow issue
http://stackoverflow.com/questions/26877936/angularjs-orderby-same-property-as-ngmodel-throws-digest-error
Angular Version
Occuring on 1.3.2
and 1.3.0
. I have not checked versions previous to 1.3.0