本文整理汇总了TypeScript中entcore._.chain方法的典型用法代码示例。如果您正苦于以下问题:TypeScript _.chain方法的具体用法?TypeScript _.chain怎么用?TypeScript _.chain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entcore._
的用法示例。
在下文中一共展示了_.chain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: findCopyIndexOfCurrentCopy
link:(scope:any) => {
var subjectCopyList:ISubjectCopy[] =
_.chain(SubjectCopyService.getListBySubjectScheduled(scope.subjectScheduled)).filter(function (subjectCopy) {
//filter only copy has submitted or due_date is past
return SubjectCopyService.canCorrectACopyAsTeacher(scope.subjectScheduled, subjectCopy);
}).sortBy( function(subjectCopy) {
return subjectCopy.owner_username;
}).value();
scope.redirectToDashboard = function(isCorrected:boolean) {
if (isCorrected) {
var copy = SubjectCopyService.getById(scope.subjectCopy.id);
copy.is_correction_on_going = true;
copy.is_corrected = true;
scope.$emit('E_UPDATE_SUBJECT_COPY', copy, false);
} else {
$location.path('/dashboard/teacher/correction/'+scope.subjectScheduled.id);
}
};
scope.redirectToSubjectDashboard = function() {
$location.path('/dashboard');
};
scope.redirectToCorrectDashboard = function() {
$location.path('dashboard/teacher/correction');
};
scope.$on('E_SUBJECT_COPY_UPDATED', function(event, redirect:boolean) {
if (redirect) {
$location.path('/dashboard/teacher/correction/'+scope.subjectScheduled.id);
}
});
scope.copyIsCorrected = function(){
return scope.subjectCopy.is_corrected;
};
function findCopyIndexOfCurrentCopy() {
return _.findIndex(subjectCopyList, function(subjectCopy) { return subjectCopy.id === scope.subjectCopy.id });
};
scope.redirectToNextCopy = function() {
template.close("main");
let index = findCopyIndexOfCurrentCopy() + 1;
$timeout(function(){
$location.path('/subject/copy/view/'+ scope.subjectScheduled.subject_id + '/' + subjectCopyList[index].id + '/');
},50);
};
scope.redirectToPreviousCopy = function() {
template.close("main");
let index = findCopyIndexOfCurrentCopy() - 1;
$timeout(function(){
$location.path('/subject/copy/view/'+ scope.subjectScheduled.subject_id + '/' + subjectCopyList[index].id + '/');
},50);
};
scope.hasNextCopy = function() {
return scope.subjectCopy.id !== subjectCopyList[subjectCopyList.length-1].id;
};
scope.hasPreviousCopy = function() {
return scope.subjectCopy.id !== subjectCopyList[0].id;
}
}