当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript _.forEach方法代码示例

本文整理汇总了TypeScript中entcore._.forEach方法的典型用法代码示例。如果您正苦于以下问题:TypeScript _.forEach方法的具体用法?TypeScript _.forEach怎么用?TypeScript _.forEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entcore._的用法示例。


在下文中一共展示了_.forEach方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

                }, function () {
                    scope.grainCopy.grain_copy_data.custom_copy_data = new CustomData(scope.grainCopy.grain_copy_data.custom_copy_data);
                    scope.customData = scope.grainCopy.grain_copy_data.custom_copy_data;
                    //shuffle
                    if (scope.customData.answersType === 'list') {
                        _.forEach(scope.customData.zones, function (zone) {
                            var tmp = _.clone(zone.options);
                            var secureLoop = 0;

                            if (tmp && tmp.length > 1) {
                                while (zone.options[0] === tmp[0]) {
                                    zone.options = _.shuffle(zone.options);
                                    if (secureLoop === 5) return false;
                                    secureLoop++;
                                }
                            }
                        });
                    } else if (scope.customData.answersType === 'drag') {
                        var tmp = _.clone(scope.customData.options);
                        var secureLoop = 0;
                        if (tmp && tmp.length > 1) {
                            while (scope.customData.options[0] === tmp[0] && !(secureLoop === 5)) {
                                scope.customData.options = _.shuffle(scope.customData.options);
                                secureLoop++;
                            }
                        }

                        scope.dragOptions = [];
                        var i=0;

                        _.forEach(scope.customData.options, function (option) {
                            scope.dragOptions.push({id:i,option:option});
                            i++;
                        });

                        //case of several fillZone in the same subject
                        scope.usedAnswers = [];

                        // init usedAnswers
                        if (scope.customData.zones) {
                            _.forEach(scope.customData.zones, function (zone) {
                                if (zone.answer) {
                                    for (let option of scope.dragOptions) {
                                        if (option.option === zone.answer && option.zoneId === undefined) {
                                            option.zoneId = zone.id;
                                            scope.usedAnswers.push(option);
                                            break;
                                        }
                                    }
                                }
                            });
                        }

                    }
                });
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:55,代码来源:perform.ts

示例2: init

                function init(subjectScheduled){
                    SubjectCopyService.resolveBySubjectScheduled_force(subjectScheduled).then(
                        function () {
                            scope.subjectCopyList = SubjectCopyService.getListBySubjectScheduled(subjectScheduled);
                            scope.subjectCopyList.forEach(copy => {
                                if(copy.is_corrected){
                                    scope.score.sum += copy.final_score;
                                    scope.score.nb++;
                                }
                            });
                            CorrectionService.automaticCorrection(scope.subjectCopyList, scope.selectedSubjectScheduled);
                        }
                    );

                    let r = _.map(_.union(scope.selectedSubjectScheduled.scheduled_at.userList, scope.selectedSubjectScheduled.scheduled_at.groupList), _.clone);

                    let total = r.length;
                    let current = 1;
                    _.forEach(r, function (obj) {
                        if (total !== current) obj.name = obj.name + ' - ';
                        current++;
                    });

                    scope.lUserGroup = r;
                    scope.selectedSubjectScheduled.lUserGroup = scope.lUserGroup;
                }
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:26,代码来源:teacherDashboardCorrectionCopyList.ts

示例3: function

                ArchivesService.getListArchivedSubjectScheduledCopy(subjectScheduled.id , (array => {
                    scope.subjectCopyList = array;
                    let r = _.map(_.union(scope.selectedSubjectScheduled.scheduled_at.userList, scope.selectedSubjectScheduled.scheduled_at.groupList), _.clone);

                    let total = r.length;
                    let current = 1;
                    _.forEach(r, function (obj) {
                        if (total !== current) obj.name = obj.name + ' - ';
                        current++;
                    });

                    scope.lUserGroup = r;
                }))
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:13,代码来源:dashboardArchivesCopyList.ts

示例4: function

				return http.get('/userbook/structures').then(function(d){
					this.load(d.data);
					_.forEach(that.all, function(struct){
						struct.parents = _.filter(struct.parents, function(parent){
							var parentMatch = _.findWhere(that.all, {id: parent.id})
							if(parentMatch){
								parentMatch.children = parentMatch.children ? parentMatch.children : []
								parentMatch.children.push(struct)
								return true
							} else
								return false
						})
						if(struct.parents.length === 0)
							delete struct.parents
					})
					this.trigger('sync');
				}.bind(this))
开发者ID:entcore,项目名称:entcore,代码行数:17,代码来源:model.ts

示例5: init

                function init(subjectScheduled){
                    SubjectCopyService.resolveBySubjectScheduled_force(subjectScheduled).then(
                        function () {
                            scope.subjectCopyList = SubjectCopyService.getListBySubjectScheduled(subjectScheduled);
                        }
                    );

                    let r = _.map(_.union(scope.selectedSubjectScheduled.scheduled_at.userList, scope.selectedSubjectScheduled.scheduled_at.groupList), _.clone);

                    let total = r.length;
                    let current = 1;
                    _.forEach(r, function (obj) {
                        if (total !== current) obj.name = obj.name + ' - ';
                        current++;
                    });
                    
                    scope.lUserGroup = r; 
                };
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:18,代码来源:teacherDashboardSimpleCorrectionCopyList.ts


注:本文中的entcore._.forEach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。