obj | ObjectArray | 被迭代的对象. |
iterator | Function | 迭代函数 |
context(optional) | Object | Object to become context (this) for the iterator function. |
var heros = [{ "hero" : "曙光女神", "role" : "sup", "line" : "不管刮风还是下雨,太阳照常升起"}], context = document.getElementById('context'), arr = []; angular.forEach(heros,function(hero,index,objs){ //value === objs[index] angular.forEach(hero,function(value,index){ this.push(index+"-"+value); },arr); }); context.innetText?context.innetText = arr.join(''):context.textContent = arr.join('');效果: http://runjs.cn/detail/ixfp2ics
新闻热点
疑难解答