mercredi 22 novembre 2017

Error in checkbox select from array

I have an array that comes from the database. In my controller, I have this code:

$rootScope.photobloblist=[];
angular.forEach($scope.photos, function(value3, key3) {
              if(key3=="Landscape"){
                $rootScope.photobloblist=[];
                console.log(key3+"----"+value3.length);
                    angular.forEach(value3, function(value2, key2) {
                              for(var i = 0;i<value2.length;i++){
                                if(key2==Categoryname)
                                  $rootScope.photobloblist.push(value2[i]);
                                console.log( $rootScope.photobloblist);
                              }                      
                     });             
              }

            });

And in my html file, I have a table and a checkbox that has an ng-model of item.selected

<tr ng-repeat="item in photobloblist" >
    <td><input type="checkbox" name="select" value="selected" ng-model="item.selected"></td>
    <td></td>
    <td><img ng-src='' width='150px' height='100px'></td>
</tr>

My problem is that I can't check any of the checkbox and it shows an error of "Cannot create property selected on string". How can I possible fix this error. I need to use checkbo for my delete function




Aucun commentaire:

Enregistrer un commentaire