码迷,mamicode.com
首页 > Web开发 > 详细

Angular JS break ForEach

时间:2015-09-24 14:48:13      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

accepted

There‘s no way to do this. See https://github.com/angular/angular.js/issues/263. Depending on what you‘re doing you can use a boolean to just not going into the body of the loop. Something like:

var keepGoing = true;
angular.forEach([0,1,2], function(count){
  if(keepGoing) {
    if(count == 1){
      keepGoing = false;
    }
  }
});

Angular JS break ForEach

标签:

原文地址:http://my.oschina.net/u/2357525/blog/510647

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!