Error when trying to assign a new value to a repeat object

Asked

Viewed 15 times

0

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

Typeerror: Cannot 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;
                    }
                }
            }
         }
     });

1 answer

1


You’re comparing whether there’s a if ($scope.content.dados[i]) using the variable i but assigns the value using the variable j

Browser other questions tagged

You are not signed in. Login or sign up in order to post.