I'm fairly new to Angular and am probably missing something obvious but I have the following custom filter:
propertyApp.filter('telLink', function() {
return function(tel) {
// To avoid interpolating error
if(typeof(tel) != undefined) {
// Remove any leading zeros
if(tel.charAt(0) === '0') {
tel = tel.substr(1);
}
tel = "44" + tel;
// Remove any internal whiespace
return tel.replace(" ", "");
}
}
});
When I use this in a view I get this:
Can't interpolate: tel:{{property.agent_phone | telLink}}
TypeError: Cannot call method 'charAt' of undefined
Could someone point me in the right direction? Thanks in advance.