Javascript ng选择不';无法渲染数组列表?

Javascript ng选择不';无法渲染数组列表?,javascript,angularjs,Javascript,Angularjs,不知道怎么了,有线索吗?我发现使用ng repeat不好,尝试了ng select,但没有渲染任何内容 <select name="country" ng-model="user.country" ng-options="country.name for country in country_list" > {{name}} </select> $sope.country_list =

不知道怎么了,有线索吗?我发现使用ng repeat不好,尝试了ng select,但没有渲染任何内容

<select name="country" ng-model="user.country"
                  ng-options="country.name for country in country_list" >
              {{name}}
          </select>

$sope.country_list = [
      {name: 'Afghanistan', code: 'AF'}, 
      {name: 'Åland Islands', code: 'AX'}, 
      {name: 'Albania', code: 'AL'}, 
      {name: 'Algeria', code: 'DZ'}, 
      {name: 'American Samoa', code: 'AS'}, 
      {name: 'AndorrA', code: 'AD'}
];

{{name}}
$sope.country\u列表=[
{名称:'Afghanistan',代码:'AF'},
{名称:'Åland Islands',代码:'AX'},
{名称:'albana',代码:'AL'},
{名称:'阿尔及利亚',代码:'DZ'},
{名称:'美属萨摩亚',代码:'AS'},
{名称:'安道尔',代码:'AD'}
];

您有一行输入错误6,$scope not$sope

您有一行输入错误6,$scope not$sope

您可以尝试:

<select ng-options="country as country.name for country in country_list" ></select>

您可以试试:

<select ng-options="country as country.name for country in country_list" ></select>


您的打字错误是
$scope
而不是
$sope
。请参见工作您有一个打字错误
$scope
而不是
$sope
。请参见工作

ah我看到了lol。为什么第一个选项为空?如何设置默认值?您需要将select的ng模型设置为数组中的第一个对象ah I see lol。为什么第一个选项为空?如何设置默认值?需要将select的ng模型设置为数组中的第一个对象