CHanged native foreach to angular foreach to support ie

change from using javascript native foreach function to using angular forach.
Internet explorer javascript does not support foreach on arrays.