How do I access parseFloat inside an angular factory function named parseFloat?
angular
.module('myApp')
.factory('mathService', [MathService]);
function MathService() {
return {
parseFloat: parseFloat
};
function parseFloat(num) {
// this should be the global parseFloat
// and not the this math service parseFloat
return parseFloat(num, 10); // how do I fix this line?
}
}
Currently this causes infinite recursion. How do I access the global parseFloat inside this factory method called parseFloat?
window.parseFloat(num, 10)
should work.