The default value is not ? object:null ? in select option Angularjs

Triet Pham

This is code in file js

$scope.ListOption = [];
$scope.ListOption.push({ Value: "0", Name: Car });
$scope.ListOption.push({ Value: "1", Name: House });

Here's what the code HTML looks like

<select class="form-control" id="Category" ng-model="Category">

<option ng-repeat="option in ListOption" value="{{option.Value}}">
 {{option.Name}}</option>

</select>

The generated html is

<select class="form-control ng-pristine ng-valid" ng-model="Category" style="padding: 0px;">
<option value="? object:null ?"></option>
<option ng-repeat="option in ListOption" value="0" class="ng-binding ng-scope">Car</option>
<option ng-repeat="option in ListOption" value="1" class="ng-binding ng-scope">House</option>
</select>

I have quite a headache on this issue. Looking forward to having someone help me the other way.

Kenry Sanchez

it's wrong. you are matching with option. Change it. I suggest, use the track by $index for no repeat options

<option value="{{option.Value}}" ng-repeat="option in ListOption track by $index">
 {{option.Name}}
</option>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AngularJS select creates option with value "? object:null ?" and doesn't use empty default option when bound to null

From Dev

Remove first value ? object:null ? in select option Angularjs

From Dev

Set default value of select to null option

From Dev

Select Option in AngularJS returning object not value

From Dev

AngularJS - ng-repeat default value for select option

From Dev

add default option to angularjs select

From Dev

AngularJS Setting the active option of a select element to the value of a different angular object

From Dev

AngularJS null value for select

From Dev

ng-Select Option set default value from list if value match using angularJS

From Dev

ng-Select Option set default value from list if value match using angularJS

From Dev

AngularJS : how to create select option and set default select option?

From Dev

Default option in select is not working using AngularJS

From Dev

AngularJS - how to set default select option

From Dev

Reset select to default value with AngularJS

From Dev

Set default Value select AngularJS

From Dev

Set default value for select in angularjs

From Dev

Select Option Value return Integer by default

From Dev

Codeigniter in select option default value not working

From Dev

how to set a default value for select option

From Dev

Select Option Value return Integer by default

From Dev

Default Select Option Based on Input Value

From Dev

Skip select option if default value come

From Dev

Default value to select option menu is not recognized

From Dev

how to pass select option value in angularjs

From Dev

AngularJS bootstrap Select-Picker default value

From Dev

Angularjs how to set the default value for select

From Dev

AngularJS - Data binding default value of html select

From Dev

Unable to set default value on AngularJS select box

From Dev

AngularJS ui-select dropdown default value

Related Related

  1. 1

    AngularJS select creates option with value "? object:null ?" and doesn't use empty default option when bound to null

  2. 2

    Remove first value ? object:null ? in select option Angularjs

  3. 3

    Set default value of select to null option

  4. 4

    Select Option in AngularJS returning object not value

  5. 5

    AngularJS - ng-repeat default value for select option

  6. 6

    add default option to angularjs select

  7. 7

    AngularJS Setting the active option of a select element to the value of a different angular object

  8. 8

    AngularJS null value for select

  9. 9

    ng-Select Option set default value from list if value match using angularJS

  10. 10

    ng-Select Option set default value from list if value match using angularJS

  11. 11

    AngularJS : how to create select option and set default select option?

  12. 12

    Default option in select is not working using AngularJS

  13. 13

    AngularJS - how to set default select option

  14. 14

    Reset select to default value with AngularJS

  15. 15

    Set default Value select AngularJS

  16. 16

    Set default value for select in angularjs

  17. 17

    Select Option Value return Integer by default

  18. 18

    Codeigniter in select option default value not working

  19. 19

    how to set a default value for select option

  20. 20

    Select Option Value return Integer by default

  21. 21

    Default Select Option Based on Input Value

  22. 22

    Skip select option if default value come

  23. 23

    Default value to select option menu is not recognized

  24. 24

    how to pass select option value in angularjs

  25. 25

    AngularJS bootstrap Select-Picker default value

  26. 26

    Angularjs how to set the default value for select

  27. 27

    AngularJS - Data binding default value of html select

  28. 28

    Unable to set default value on AngularJS select box

  29. 29

    AngularJS ui-select dropdown default value

HotTag

Archive