AngularJS ng-options not rendering values

前端 未结 4 1632
说谎
说谎 2020-12-17 16:37

How can I render the value of the following options list?

$scope.limits = [ {value:  \'5\', text: \'Afficher 5 par page\'},
                  {value: \'10\',         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 17:23

    The ng-options directive does not set the value attribute on the elements. It always uses a sequence.

    Using limit.value as limit.text for limit in limits means:

    • Set the 's label as limit.text
    • Save the limit.value value into the select's ng-model

    Check this fiddle: http://jsfiddle.net/bmleite/k58Hw/

提交回复
热议问题