javascript - AngularJs - Find relational information in two arrays -


i'm getting 2 json arrays api. data examples:

serie type:

[     {"id":1,"bettypeid":1, "nameeng":"win"},     {"id":2,"bettypeid":1,"nameeng":"draw"} ] 

bet type:

    [         {"id":1,"nameeng":"3-way result","sportid":1             {"id":2,"nameeng":"double chance","sportid":1}     ] 

as can see, serie type objects has bettypeid. need remote bet type object array there no serie type it.

i have tried looping in bet type array don't how filter in serie types.

what steps achieve this?

you can filter array way:

bettypesarray = bettypesarray.filter(function(bet) {   // if seriestype item references bet, keep   return seriestypearray.some(function(serie) {     return serie.bettypeid === bet.id;   }); }); 

does solve problem?


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -