I have two arrays like this :

```
var friendemail  = [ {
    "data": {
        "status": "OK",
        "message": "User list fetched successfully",
        "userList": [
            {
                "userId": 1,
                "emailId": "abc.com",
                "firstName": "Abc",
                "lastName": "Xyz",
                "nickName": "Nic",
                "type": "USER",
                "apiKey": "355901361"
            },
            {
                "userId": 2,
                "emailId": "babitadhami@g.com",
                "firstName": "Babita",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "333234567"
            },
            {
                "userId": 3,
                "emailId": "testuser@g.com",
                "firstName": "Test_User",
                "lastName": "Account",
                "nickName": "Testi",
                "type": "USER",
                "apiKey": "1403626362113"
            },
            {
                "userId": 4,
                "emailId": "dhami@gmail.com",
                "firstName": "dhami",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "DEVELOPER",
                "apiKey": "222234567"
            },
            {
                "userId": 5,
                "emailId": "babita.dhami@g.com",
                "firstName": "Babita",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "1403709178117"
            },
            {
                "userId": 6,
                "emailId": "Chris@abc.com",
                "firstName": "dhami",
                "lastName": "dhami",
                "nickName": "dhami",
                "type": "DEVELOPER",
                "apiKey": "333234567"
            },
            {
                "userId": 7,
                "emailId": "kevin.wei@qdevinc.com",
                "firstName": "abc",
                "lastName": "xyz",
                "nickName": "none",
                "type": "DEVELOPER",
                "apiKey": "111234567"
            },
            {
                "userId": 8,
                "emailId": "dhamji@gmail.com",
                "firstName": "Bab",
                "lastName": "Dham",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "1403790266057"
            },
            {
                "userId": 9,
                "emailId": "info@hemlockhills.ca",
                "firstName": "Jenn",
                "lastName": "Becker",
                "nickName": "JennB",
                "type": "USER",
                "apiKey": "355901361"
            },
            {
                "userId": 10,
                "emailId": "babitadhami1@gmail.com",
                "firstName": "Babita",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "333234567"
            },
            {
                "userId": 11,
                "emailId": "b.dhami@g.com",
                "firstName": "Babita",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "333234567"
            },
            {
                "userId": 12,
                "emailId": "dhami.babita@g.com",
                "firstName": "Babita",
                "lastName": "Dhami",
                "nickName": "bobby",
                "type": "USER",
                "apiKey": "333234567"
            },
            {
                "userId": 13,
                "emailId": "Francie@abc.com",
                "firstName": "Francie",
                "lastName": "Francie",
                "nickName": "Francie",
                "type": "USER",
                "apiKey": "111234567"
            },
            {
                "userId": 14,
                "emailId": "Sam@abc.com",
                "firstName": "Sam",
                "lastName": "M",
                "nickName": "S",
                "type": "USER",
                "apiKey": "111234567"
            },
            {
                "userId": 15,
                "emailId": "Sid@abc.com",
                "firstName": "Sid",
                "lastName": "B",
                "nickName": "S",
                "type": "USER",
                "apiKey": "22234567"
            },
            {
                "userId": 16,
                "emailId": "tim@outlook.com",
                "firstName": "tim",
                "lastName": "tim",
                "nickName": "tim",
                "type": "USER",
                "apiKey": "111234567"
            },
            {
                "userId": 17,
                "emailId": "racing@gmail.com",
                "firstName": "racing",
                "lastName": "racing",
                "nickName": "Hollywood",
                "type": "USER",
                "apiKey": "222234567"
            }
        ]
    },
    "status": 200,
    "config": {
        "method": "GET",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "url": "",
        "headers": {
            "Accept": "application/json, text/plain, */*"
        }
    },
    "statusText": "OK"
}]

```

and another is 

```
var deviceContactEmail = [
    {
        "id": "1",
        "rawId": "1",
        "displayName": "kandwal",
        "name": {
            "formatted": "kandwal",
            "givenName": "kandwal"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "testuser@g.com",
                "id": "6",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/1/photo",
                "type": "url",
                "id": "1",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "2",
        "rawId": "2",
        "displayName": "xyz",
        "name": {
            "formatted": "xyz ",
            "givenName": "xyz"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "Chris@abc.com",
                "id": "12",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/2/photo",
                "type": "url",
                "id": "7",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "3",
        "rawId": "3",
        "displayName": "cdf",
        "name": {
            "formatted": "cdf",
            "givenName": "cdf"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": null,
        "addresses": [
            {
                "region": "Uk",
                "id": "19",
                "locality": "Dehra Dun",
                "formatted": "dddd",
                "type": "home",
                "pref": false,
                "country": "India"
            }
        ],
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/3/photo",
                "type": "url",
                "id": "14",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "4",
        "rawId": "4",
        "displayName": "abcd",
        "name": {
            "formatted": "scd ",
            "givenName": "scd"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "dhami@gmail.com",
                "id": "26",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/4/photo",
                "type": "url",
                "id": "21",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "5",
        "rawId": "5",
        "displayName": "hiteshbhattcse@gmail.com",
        "name": {
            "formatted": "hiteshbhattcse@gmail.com ",
            "givenName": "hiteshbhattcse@gmail.com"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "hiteshbhattcse@gmail.com",
                "id": "33",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/5/photo",
                "type": "url",
                "id": "28",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "6",
        "rawId": "6",
        "displayName": "hitet@gmail.com",
        "name": {
            "formatted": "hitet@gmail.com ",
            "givenName": "hitet@gmail.com"
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "hiteshbhatt@gmail.com",
                "id": "40",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/6/photo",
                "type": "url",
                "id": "35",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "7",
        "rawId": "7",
        "displayName": null,
        "name": {
            "formatted": ""
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "mayank.th088@gmail.com",
                "id": "46",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/7/photo",
                "type": "url",
                "id": "41",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    },
    {
        "id": "8",
        "rawId": "8",
        "displayName": null,
        "name": {
            "formatted": ""
        },
        "nickname": null,
        "phoneNumbers": null,
        "emails": [
            {
                "type": "other",
                "value": "gcjoshi83@gmail.com",
                "id": "53",
                "pref": false
            }
        ],
        "addresses": null,
        "ims": null,
        "organizations": null,
        "birthday": null,
        "note": "",
        "photos": [
            {
                "value": "content://com.android.contacts/contacts/8/photo",
                "type": "url",
                "id": "48",
                "pref": false
            }
        ],
        "categories": null,
        "urls": null
    }]

```

I want to compare both of them for email id . and wanna get the common email id inside 1 array and rest in one array from deviceContactEmail.

I tried angular. each but not getting success.

```
var wUser = [];
    var nonWUser = [];
angular.forEach(deviceContactEmail, function(phonevalue){               
            console.log(phonevalue);
                 angular.forEach(friendemail, function(value){
                if (phonevalue.emails) {
                if(phonevalue.emails[0].value === value.emailId){
                    console.log(phonevalue.emails[0].value);
                    wUser.push(phonevalue);
                    }else{
                        console.log("------------------------------------------------------------------------");
                        console.log(phonevalue.emails[0].value);
                       nonWUser.push(phonevalue);

                        };
                 }

                })  

            })

```