0

I've built, for the select options, the following array:

$scope.typeOptions = [
    { name: 'Pontos', value: 'PONTOS' },
    { name: 'Multipla Escolha', value: 'MULTIPLA_ESCOLHA' },
    { name: 'Texto', value: 'TEXTO' }
];
$scope.type = $scope.typeOptions[0].value;

And used the following on my HTML view

<select ng-model="type" required="required" ng-options="t.value as t.name for t in typeOptions">
</select>

But then it gives me the following:

<select ...>
    <option value="string:PONTOS" label="Pontos" selected="selected">Pontos</option>
    ...
</select>

Adding string: to the beggining of each value. How do I remove it?

EDIT: Although it's said that this is intentional and this value seen on HTML does not corresponds to the actual value, when the form is submitted, the value recieved comes with the "string:" part as well.

  • @DanielA.White, do go on. – isherwood May 13 '15 at 18:16
  • Reading this post, It seems to me to be a different problem. It was solved when used `ng-options` instead of `ng-repeat`. Here, though, I'm already using `ng-options`... – Gabriel Vasconcelos May 13 '15 at 18:19
  • Also, this select value is within a form, and the server recieves the 'string:' part just as well... – Gabriel Vasconcelos May 13 '15 at 18:22
  • 1
    With angular, you're only ever dealing with model in the scope, so however angular changes the DOM to ensure your model gets updated properly shouldn't matter. Angular isn't really designed to do full page form submits where the value in the option does matter. See http://stackoverflow.com/questions/16945837/angular-js-submit-form-old-way/16945970#16945970 – dnc253 May 13 '15 at 18:41
  • This seems like a related but separate issue. – jjbskir Nov 05 '15 at 21:00

0 Answers0