本文整理汇总了TypeScript中entcore.angular类的典型用法代码示例。如果您正苦于以下问题:TypeScript angular类的具体用法?TypeScript angular怎么用?TypeScript angular使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了angular类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
scope.dropToRight = function ($item, targetItem, index, right, left) {
scope.setHover(index, right, left);
if(targetItem.text_right){
scope.grainCopy.grain_copy_data.custom_copy_data.all_possible_answer.push({
item : angular.copy(targetItem.text_right),
rank : 0.5 - Math.random()
});
}
targetItem.text_right = angular.copy($item.item);
scope.$apply();
scope.all_possible_answer_pop(targetItem.text_right);
scope.updateGrainCopy();
};
示例2: function
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
answerCorrect = false;
angular.forEach(grainScheduled_correct_answer_list, function(correct_answer){
if(!correct_answer.alreadyMatch){
if(CompareStringHelper.compare
(
correct_answer.text,
filled_answer.text
) === true){
answerCorrect = true;
correct_answer.alreadyMatch = true;
}
}
});
if(answerCorrect){
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
}
});
示例3: automaticCorrection
public automaticCorrection(grainScheduled:IGrainScheduled, grainCopy:IGrainCopy):{calculated_score:number, answers_result:{}} {
var numberGoodAnswer : number = 0,
atLeastOneError = false,
answerCorrect,
isCorrectReturnArray = {},
grainScheduled_correct_answer_list = angular.copy(grainScheduled.grain_data.custom_data.correct_answer_list);
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
answerCorrect = false;
angular.forEach(grainScheduled_correct_answer_list, function(correct_answer){
if(!correct_answer.alreadyMatch){
if(CompareStringHelper.compare
(
correct_answer.text,
filled_answer.text
) === true){
answerCorrect = true;
correct_answer.alreadyMatch = true;
}
}
});
if(answerCorrect){
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
}
});
// computation score
var numberPossibleAnswer : number = grainScheduled.grain_data.custom_data.correct_answer_list.length;
var calculated_score = (numberGoodAnswer / numberPossibleAnswer) * grainScheduled.grain_data.max_score;
if(isNaN(calculated_score)){
throw "calculated score is not a number"
}
return {
calculated_score: calculated_score,
answers_result: isCorrectReturnArray
};
}
示例4: function
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
if(angular.isUndefined(filled_answer.isChecked)){
filled_answer.isChecked = false;
}
if(angular.isUndefined(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked)){
grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked = false;
}
if(filled_answer.isChecked === grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
if(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
// response is check and good
// in this case numberGoodAnswer++
numberRecognizedAnswer++;
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
// response is not check and good
// in this case the answer is not good
isCorrectReturnArray[key] = undefined;
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
numberRecognizedAnswer++;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
if(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
// response is check and not good
isCorrectReturnArray[key] = true;
} else {
// response is not check and not good
isCorrectReturnArray[key] = false;
}
}
});
示例5: placeToolbar
element.on('editor-blur', 'editor', (e) => {
placeToolbar();
if($('editor.focus').length === 0){
$('sticky-row').removeClass('hide');
}
$(e.target).parents('grid-cell').data('lock', false);
let cell = $(e.target).parents('grid-cell .media-wrapper');
let cellScope = angular.element(cell[0]).scope();
cellScope.cell.focus = false;
scope.$apply();
});
示例6: function
link: (scope:any) => {
var result = AssociationService.automaticCorrection(scope.grainScheduled, scope.grainCopy);
scope.isCorrect = result.answers_result;
if (angular.isUndefined(scope.grainCopy.calculated_score) || scope.grainCopy.calculated_score === null) {
scope.grainCopy.calculated_score = result.calculated_score;
scope.$emit('E_UPDATE_GRAIN_COPY', scope.grainCopy);
}
scope.updateGrainCopy = function () {
if (scope.isTeacher) {
scope.$emit('E_UPDATE_GRAIN_COPY', scope.grainCopy);
}
};
}