0

I am getting red toaster error in Chrome version 57. If I use both ng-model and ng-disable.

I have tab like below:

<input type="checkbox" ng-value="true" ng-model="classification" ng-disabled="classification === true">

By default classification is false. When user check the checbox, classification become true and same time disabling the checkbox.

It was worked fine in Chrome Version less than 57. Now we are using Chrome V57. This issue not occurring in IE and Mozilla.

We are using Angular 1.3

Kindly share if anyone have any solution for this.

Thanks in advance.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Mahesh G
  • 1
  • 3

1 Answers1

0

I created an example. Please check.

<!DOCTYPE html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.2.0/angular.min.js"></script>
</head>
<body>
<input type="checkbox" ng-model="checked" ng-disabled="checked">Check<br/>
</body>
</html>
Ananya
  • 201
  • 1
  • 15
  • By the way, it's ng-disabled not ng-disable. I hope this may help you out. – Ananya Apr 18 '17 at 11:28
  • Sorry it was typo mistake. Thanks @Ananya. This is also not working as expected in my application. I am able to disable the checkbox but getting below error: Error: [$rootScope:inprog] http://errors.angularjs.org/1.3.0/$rootScope/inprog?p0=NaNigest – Mahesh G Apr 18 '17 at 11:34
  • This is digest cycle problem. Either we can use: if(!$scope.$$phase) { //$digest or $apply //write updates here } OR $timeout(function() { // anything you want can go here and will safely be run on the next digest. }) – Ananya Apr 18 '17 at 11:39
  • but I am not sure where to add this code in my big application... @Ananya Could you please suggest how to fix this issue ? – Mahesh G Apr 18 '17 at 12:57
  • $(timeout(function() { // Update scope variables i.e. classification }); Try this once – Ananya Apr 18 '17 at 13:17
  • I tried like below but same results. Let me correct if I am wrong. $scope.clickHere = function () { $(timeout(function() { $scope.classification = true; })); } – Mahesh G Apr 18 '17 at 14:54
  • $scope.clickHere = function () { $(timeout(function() { $scope.$apply(function() { $scope.classification = true; }); }); } – Ananya Apr 19 '17 at 04:58