Error trying to assign a new value to a repeating object

0

I need to assign or even create a new attribute on an object within a loop, but it is giving the following error, which I have no idea what it is:

  

TypeError: Can not create property 'is_content_hide' on boolean 'false'

EmailService.setMail(data)
     .then(function(result){
         if (result.status) {
            if (angular.isDefined(result.em_massa) && result.em_massa) {
                for (var i in $scope.content.dados) {
                    if ($scope.content.dados[i]) {
                       $scope.content.dados[j].is_content_hide = true;
                    }
                }
            }
         }
     });
    
asked by anonymous 21.09.2018 / 19:35

1 answer

1

You are comparing whether if ($scope.content.dados[i]) exists using the variable i but assigns the value using the variable j

    
21.09.2018 / 19:39