本文整理汇总了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');
};
示例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();
});
示例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);
};
示例4:
classList.forEach(function(myClass){
if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
Birthday.classes.push({
name: myClass[1],
id: myClass[0]
});
}
});
示例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);
}
}
});
示例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();
};
}
示例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;
};
示例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();
};
示例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;
}
}