Skip to main content
added 75 characters in body
Source Link
Satpal
  • 133.5k
  • 13
  • 168
  • 171

Hello guys i cant find actually info about convert string to array and after check them.Im trying check have this post in usermeta or not. Before converting to array this string. But it doesnt work why?

  $scope.like = function(id) {
    PostService.GetUserMeta(user)
      .then(function(data) {
        var likes = '290 270'
        var check_likes = likes.split(" ");
        if (check_likes !=id= id) {
            $http.jsonp('http://somesite.com/api/userplus/update_user_meta_vars/', {
                params: {
                    like_post: id + ',' + likes,
                    callback: "JSON_CALLBACK"
                }
            }).success(function(data) {
                console.log('Id added to array'); 
  
           });
    }
    } else {
            console.log('ID already in array');
        }
    }) 
}

Hello guys i cant find actually info about convert string to array and after check them.Im trying check have this post in usermeta or not. Before converting to array this string. But it doesnt work why?

  $scope.like = function(id) {
    PostService.GetUserMeta(user)
      .then(function(data){
        var likes = '290 270'
        var check_likes = likes.split(" ");
    if(check_likes!=id) {
    $http.jsonp('http://somesite.com/api/userplus/update_user_meta_vars/', {
      params: {
        like_post: id + ',' + likes,
        callback: "JSON_CALLBACK"
      }
     }).success(function(data) {
        console.log('Id added to array');  
      });
    }
    else {
      console.log('ID already in array');
    }
  })}

Hello guys i cant find actually info about convert string to array and after check them.Im trying check have this post in usermeta or not. Before converting to array this string. But it doesnt work why?

$scope.like = function(id) {
    PostService.GetUserMeta(user).then(function(data) {
        var likes = '290 270'
        var check_likes = likes.split(" ");
        if (check_likes != id) {
            $http.jsonp('http://somesite.com/api/userplus/update_user_meta_vars/', {
                params: {
                    like_post: id + ',' + likes,
                    callback: "JSON_CALLBACK"
                }
            }).success(function(data) {
                console.log('Id added to array'); 
            });
        } else {
            console.log('ID already in array');
        }
    }) 
}
Source Link

Check value in angular array

Hello guys i cant find actually info about convert string to array and after check them.Im trying check have this post in usermeta or not. Before converting to array this string. But it doesnt work why?

  $scope.like = function(id) {
    PostService.GetUserMeta(user)
      .then(function(data){
        var likes = '290 270'
        var check_likes = likes.split(" ");
    if(check_likes!=id) {
    $http.jsonp('http://somesite.com/api/userplus/update_user_meta_vars/', {
      params: {
        like_post: id + ',' + likes,
        callback: "JSON_CALLBACK"
      }
     }).success(function(data) {
        console.log('Id added to array');  
     });
    }
    else {
      console.log('ID already in array');
    }
  })}