To be able to fix a sorting issue i need to change the compare-method of the angular library. So far i just changed the angular.js codefile directly but when we update to a newer version it will be lost. I read that it's possible to override methods in javascript.
I tried something like but it did not do the job:
angular.orderByFilter.compare = function (v2, v2) {
//Code goes here
}
Any ideas how to overwrite that function? This is how the function is declared inside the angularjs file:
function orderByFilter($parse) {
return function(array, sortPredicate, reverseOrder) {
function compare(v1, v2) {
var t1 = typeof v1;
var t2 = typeof v2;
if (t1 === t2 && t1 === "object") {
v1 = objectToString(v1);
v2 = objectToString(v2);
}
if (t1 === t2) {
if (t1 === "string") {
v1 = v1.toLowerCase();
v2 = v2.toLowerCase();
}
if (v1 === v2) return 0;
return v1 < v2 ? -1 : 1;
} else {
return t1 < t2 ? -1 : 1;
}
}
};
}