Using replace with ng-repeat result to replace underscores with spaces

I have ng-repeat="(name, value) in list.getIngredients()"and in the controller template I have:

<span>{{name.replace("_", " ")}}</span><input name="{{name}}" value="{{value}} />

What I want to do is run the function String.replace()as above, but it does not seem to recognize it.

+4
source share
1 answer
<span>{{name.replace("_", " ");}}</span><input name="{{name}}" value="{{value}} /> 

you need a semicolon. > _> When using Angular, you usually don’t need half-columns, but when you are dealing with javascript in this regard, you will need a semicolon, otherwise an error will occur.

+3
source

Source: https://habr.com/ru/post/1620462/


All Articles