Liam Liam - 3 months ago 13
AngularJS Question

Additional spaces in angularjs select option

I have a question.I have a form with select option:

<select name="recName" ng-model="newMessage.recName">
<option ng-repeat="player in newMessage.gamePlayers">
{{player.name}}
</option>
</select>


When I submit the form and debug js file, the recName variable contain player name with extra spaces. For example, player name is "Liam" and in recName is "________Liam_______" after submit.
(I added _ because spaces were ignored)

Does anyone know what is going on? Thanks.

Answer

Try to put your code in one line. Something like that :

<select name="recName" ng-model="newMessage.recName">
   <option ng-repeat="player in newMessage.gamePlayers">{{player.name}}</option>
</select>
Comments