I have an object that contains a mixture of numbers and text for values. I\'d like to apply the numbers
filter to the object\'s value when it\'s a number (obvio
You could try it this way - In your controller, you can have a function which identifies if the provided value is a string or a number:
$scope.isNumber = function (value) {
return angular.isNumber(value);
};
Next, in your view you could have the following:
{{metric}}
{{metricData | number}}
{{metricData}}
Thus, when the metricData
is a number, it is filtered and when it is a string, it is output as it is.