• 19-07-2022, 19:11:18
    #1
    var card = function (val) {
    console.log('loading profiles');
    if(val == 4){
    cards = [];
    }
    try {
    $scope.ajaxRequest = A.Game.get({action: 'game',id: user.id});
    $scope.ajaxRequest.$promise.then(function(){


    if ($scope.ajaxRequest.game != 'error') {
    $scope.ajaxRequest.game.forEach(function(entry) {
    if(cards.indexOf(entry) !== -1) {
    console.log('alredy in game');
    } else {
    if(entry.id != user.id){
    cards.push(entry);
    $scope.imageLocations.push(entry.photo);
    }
    }
    });



    bu kodda

    TypeError: Cannot read properties of undefined (reading 'forEach') hatası alıyorum.

    hata üstüne tıkladıgımda
    $scope.ajaxRequest.game.forEach(function(entry) {
    bolumu acılıyor ücretli ücretsiz yardım arıyorum
  • 19-07-2022, 19:28:00
    #2
    $scope.ajaxRequest.game

    Bunu console yazdır bakalım ne çıkacak, foreach den önce.