Change for to angular.forEach to workaround jshint