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


TypeScript _.findWhere方法代码示例

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


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

示例1: function

directory.User.prototype.loadInfos = async function(){
	var data = (await http.get('/directory/user/' + this.id)).data;
	var adminStructure, adml;

	if(this.edit && this.edit.visibility && !this.edit.userbook){
		this.loadVisibility();
	}
	data.attachedStructures = [];
	adminStructure = _.findWhere(this.schools, {id: data.administrativeStructures[0].id})
	if (adminStructure) {
		adminStructure.admin = true;
		data.attachedStructures.push(adminStructure);
	}
	if (data.functions[0][1]) {
		data.functions[0][1].forEach(id => {
			adml = _.findWhere(this.schools, {id: id});
			if (adml) {
				adml.adml = true;
				if (!adminStructure || (adminStructure && adminStructure.id !== adml.id)) {
					data.attachedStructures.push(adml);
				}
			}
		});
	}
	this.schools.forEach(structure => {
		if (!_.findWhere(data.attachedStructures, {id: structure.id})) {
			data.attachedStructures.push(structure);
		}
	});

	this.updateData(data);
	this.trigger('loadInfos');
};
开发者ID:entcore,项目名称:entcore,代码行数:33,代码来源:model.ts

示例2: function

			lang.addBundle('/directory/i18n', function(){
				Birthday.emptyList = lang.translate('nobirthday');
				Birthday.birthdays = _.filter(birthdays, function(birthday){
					return moment(birthday.birthDate).month() === moment().month();
				});

				Birthday.birthdays = Birthday.birthdays.sort(function(a, b){
					return moment(a.birthDate).date() - moment(b.birthDate).date()
				});

				var classes = [];
				classes = _.pluck(Birthday.birthdays, 'classes');
				classes.forEach(function(classList){
					classList.forEach(function(myClass){
						if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
							Birthday.classes.push({
								name: myClass[1],
								id: myClass[0]
							});
						}
					});
				});

				Birthday.currentClass = _.findWhere(Birthday.classes, { id: Birthday.currentClass.id })
				if(!Birthday.currentClass){
					Birthday.currentClass = Birthday.classes[0];
				}

				model.widgets.apply();
			});
开发者ID:entcore,项目名称:entcore,代码行数:30,代码来源:birthday.ts

示例3: function

 $scope.addBookmark = function($item){
     if(_.findWhere(model.me.bookmarkedApps, { name: $item.name }) !== undefined){
         return;
     }
     model.me.bookmarkedApps.push($item);
     $scope.$apply();
     http().putJson('/userbook/preference/apps', model.me.bookmarkedApps);
 };
开发者ID:entcore,项目名称:entcore,代码行数:8,代码来源:app.ts

示例4:

					classList.forEach(function(myClass){
						if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
							Birthday.classes.push({
								name: myClass[1],
								id: myClass[0]
							});
						}
					});
开发者ID:entcore,项目名称:entcore,代码行数:8,代码来源:birthday.ts

示例5:

		data.functions[0][1].forEach(id => {
			adml = _.findWhere(this.schools, {id: id});
			if (adml) {
				adml.adml = true;
				if (!adminStructure || (adminStructure && adminStructure.id !== adml.id)) {
					data.attachedStructures.push(adml);
				}
			}
		});
开发者ID:entcore,项目名称:entcore,代码行数:9,代码来源:model.ts

示例6: function

            link: function (scope, element, attributes) {
                scope.removeFillZone = ($event) => {
                    $event.stopPropagation();
                    scope.$parent.$eval('customData.zones').forEach((zone) => {
                        if(zone.id === parseInt(scope.zoneId)){
                            scope.$parent.customData.removeZone(zone);
                        }
                    });

                    element.remove();
                };

                scope.optionData = {
                    zoneId: parseInt(scope.zoneId),
                    zone: _.findWhere(scope.$parent.customData.zones, { id: parseInt(scope.zoneId) }),
                    correction: scope.$parent.correction
                }

                if (scope.optionData.correction) {
                    let index = scope.$parent.customData.zones.indexOf(scope.optionData.zone);
                    scope.optionData.isCorrect = scope.optionData.correction[index];
                }

                setTimeout(() => {
                    scope.optionData.mode = 'view';
                    if (element.parents('edit-fill-text').length > 0) {
                        scope.optionData.mode = 'edit';
                    }
                    if (element.parents('perform-fill-text').length > 0) {
                        scope.optionData.mode = 'perform-' + scope.$parent.customData.answersType;
                    }
                    scope.$apply();
                }, 50);
                
                var openEdit = (e) => {
                    scope.$parent.editZone(scope.optionData.zoneId);
                    e.preventDefault();
                    scope.$apply();
                };

                element.on('click', '.edit', openEdit);
                element.on('click', openEdit);
                
                element.on('change', 'input, select', () => {
                    scope.$parent.updateGrainCopy();
                });

                scope.answer = ($item) => {
                    scope.$parent.removeAnswer(scope.optionData.zone);
                    scope.optionData.zone.answer = $item.option;
                    $item.zoneId = scope.optionData.zone.id;
                    if ($item.option) {
                        scope.$parent.usedAnswers.push($item);
                    }
                    scope.$parent.updateGrainCopy();
                };
            }
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:57,代码来源:fillzone.ts

示例7:

 $scope.searchGroups = (item: Group) => {
     let found = $scope.display.searchGroups && idiom.removeAccents(item.name.toLowerCase()).indexOf(
         idiom.removeAccents($scope.display.searchGroups).toLowerCase()
     ) !== -1;
     for (let structureId in $scope.website.published) {
         found = found && _.findWhere($scope.website.published[structureId].groups, { id: item.id }) === undefined;
     }
     return found;
 };
开发者ID:web-education,项目名称:pages,代码行数:9,代码来源:library.ts

示例8:

 scope.removeOption = (container: CustomData, option: string) => {
     let i = container.options.indexOf(option);
     container.options.splice(i, 1);
     let iconZone = _.findWhere(container.zones, { answer: option });
     let j = container.zones.indexOf(iconZone);
     container.zones.splice(j, 1);
     
     scope.updateGrain();
 };
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:9,代码来源:edit.ts

示例9: findName

 let findName = (append) => {
     if (_.findWhere(this.website.pages.all, { titleLink: titleLink + append }) !== undefined) {
         append = '-' + i;
         i++;
         return findName(append);
     }
     else{
         return titleLink + append;
     }
 }
开发者ID:web-education,项目名称:pages,代码行数:10,代码来源:page.ts


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