0
我要预先加载在MD-选择如何预加载角度材料选择中的值?
值我有以下代码
<md-select ng-model="country" ng-model-options="{trackBy: '$value.code'}" >
<md-optgroup label="Country">
<md-option ng-value="country" ng-repeat="country in countries">
{{country.name}}
</md-option>
</md-optgroup>
</md-select>
控制器
$scope.country = "usa"; //I will receive only the key from the server side
//in the response object
$scope.countries = [{"code":"usa","name":"United States of America"},
{"code":"ind","name":"India"},
{"code":"eng","name":"England"},
{"code":"aus","name":"Australia"}];
在这里,我要加载“美国“ 原来。
目前无法正常工作。帮我完成这件事......
我想只发送选定对象的代码。 ng-value =“country.code”不预先加载数据。另外选择不起作用。如果我选择任意一个国家/地区,请选择下拉菜单中的最后一个条目。我怎样才能只发送密钥 – Prince