本文整理汇总了TypeScript中entcore.angular.copy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript angular.copy方法的具体用法?TypeScript angular.copy怎么用?TypeScript angular.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entcore.angular
的用法示例。
在下文中一共展示了angular.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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
};
}