Within my Angular app, I'm looking to replace all instances of _
within a string. In my controller, the following code achieves the desired outcome:
alert("this_is_string_".replace(/_/g, " "));
However, when attempting to implement the same code within my HTML file as shown below:
<th class="text-center" ng-repeat="(key, value) in filteredEL[0] ">
{{ key.replace(/_/g, ' ') }}
</th>
An error is thrown:
Error: [$parse:syntax] Syntax Error: Token '/' not a primary expression at column 13 of the expression [key.replace(/_/g, ' ')] starting at [/_/g, ' ')]
How can I properly utilize the replace function to modify all necessary instances within the HTML?