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

Unable to set default value on AngularJS select box

From Dev

Angularjs how to set the default value for select

From Dev

AngularJS null value for select

From Dev

AngularJS - Data binding default value of html select

From Dev

Reset select to default value with AngularJS

From Dev

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

From Dev

Set default value of select to null option

From Dev

Select Option Value return Integer by default

From Dev

AngularJS bootstrap Select-Picker default value

From Dev

AngularJS ui-select dropdown default value

From Dev

Codeigniter in select option default value not working

From Dev

Set default Value select 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

Select Option Value return Integer by default

From Dev

how to set a default value for select option

From Dev

Default option in select is not working using AngularJS

From Dev

Set default value for select in angularjs

From Dev

Default Select Option Based on Input Value

From Dev

add default option to angularjs select

From Dev

AngularJS - ng-repeat default value for select option

From Dev

AngularJS - how to set default select option

From Dev

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

From Dev

how to pass select option value in angularjs

From Dev

Skip select option if default value come

From Dev

Default value to select option menu is not recognized

From Dev

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

From Dev

Select Option in AngularJS returning object not 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

    Unable to set default value on AngularJS select box

  3. 3

    Angularjs how to set the default value for select

  4. 4

    AngularJS null value for select

  5. 5

    AngularJS - Data binding default value of html select

  6. 6

    Reset select to default value with AngularJS

  7. 7

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

  8. 8

    Set default value of select to null option

  9. 9

    Select Option Value return Integer by default

  10. 10

    AngularJS bootstrap Select-Picker default value

  11. 11

    AngularJS ui-select dropdown default value

  12. 12

    Codeigniter in select option default value not working

  13. 13

    Set default Value select AngularJS

  14. 14

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

  15. 15

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

  16. 16

    Select Option Value return Integer by default

  17. 17

    how to set a default value for select option

  18. 18

    Default option in select is not working using AngularJS

  19. 19

    Set default value for select in angularjs

  20. 20

    Default Select Option Based on Input Value

  21. 21

    add default option to angularjs select

  22. 22

    AngularJS - ng-repeat default value for select option

  23. 23

    AngularJS - how to set default select option

  24. 24

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

  25. 25

    how to pass select option value in angularjs

  26. 26

    Skip select option if default value come

  27. 27

    Default value to select option menu is not recognized

  28. 28

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

  29. 29

    Select Option in AngularJS returning object not value

HotTag

Archive