I have a JSON Array and i want to get the object which has the 'type':'optional'. how do i achieve that using forEach in Angular JS? please help me..
Please find below the JSON array
$scope.headerAll=
[
{
"field": "first_name",
"displayName": "First name",
"type": "required"
},
{
"field": "last_name",
"displayName": "Last Name",
"type": "required"
},
{
"field": "email",
"displayName": "Email",
"type": "required"
},
{
"field": "isMarried",
"displayName": "marital Status",
"type": "optional"
}
]