AngularJS compare two (scope) arrays and only POST the 'non-same' result (2018)
Clash Royale CLAN TAG #URR8PPP AngularJS compare two (scope) arrays and only POST the 'non-same' result (2018) I have two arrays that i like to compare on the ID, if the ID from one array does not exist in the other i will add it with the Http Post. This is the build up: $scope.Games = [{id:1,Name:"BatMan"}, {id:2,Name:"SpiderMan"}, {id:2,Name:"Hulk"}]; $scope.NewGames = [{id:1,Name:"BatMan"}, {id:2,Name:"SpiderMan"}, {id:3,Name:"Hulk"}, {id:4,Name:"DeadPool"}, {id:5,Name:"IronMan"}, , {id:6,Name:"DrStrange"}]; so i load all the Games and NewGames with a GET in the two $scopes Now i would like to compare the two on the id_game, so i was thinking of something like this but can't get it to work, the http section works find however without the indexOf, it will add...