默认值在控制器的ng-options中选择

时间:2016-12-20 23:21:25

标签: angularjs html5

我正在下载项目列表,我试图在页面加载时选择默认值。但我无法选择默认值。我想知道我错过了哪里。 这是我的HTML

    <td class="bg-panel" align="left" style="width:16.666%">
      <select class="pulldownSystems" ng-model="eurfrequency.selected" ng-options="model.name  for model in eurxfrequency track by model.code" ng-disabled="false"></select>
    </td>

这是我的控制器

$scope.ModifyConfig = function(details ){    
$scope.eurxfrequency = [{code:"60" ,name:"Every Hour"},{code:"15", name: "Every 15 mins"},{code:"30",name:"Every Half an Hour"},{code:"120",name:"Every 2 Hours"},{code:"1",name:"Daily Once"}];
alert(details.escintervaltym); // - here i am getting value 60 
$scope.eurfrequency =   details.escintervaltym ; // - Not working 
$scope.eurfrequency = {selected : details.escintervaltym }  //- Not working
}

这是我的DOM输出

<option value="?" selected="selected" label=""></option>
<option value="60" label="Every Hour">Every Hour</option>
<option value="15" label="Every 15 mins">Every 15 mins</option>
<option value="30" label="Every Half an Hour">Every Half an Hour</option
<option value="120" label="Every 2 Hours">Every 2 Hours</option>
<option value="1" label="Daily Once">Daily Once</option>
</select>

我想要做的就是在页面加载时用标签选择值60

0 个答案:

没有答案