foreach 回调用法
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>test</title> <script src="http://cdn.bootcss.com/angular.js/1.4.3/angular.min.js"></script> </head> <body> <script type='text/javascript'> var arr = ['a','b','c']; angular.forEach(arr,function(value,index){ console.log(value); if(index === arr.length - 1){ console.log(1); } }); </script> </body> </html>