我有一个选择框,
<select populate-details ng-model="properties.maxRetries.type" ng-options="value as text for (text, value) in presentation.sources.maxR_Source"></select>
填写selectbox的指令:
angular.module("test.directives").directive("populateDetails", function() {
return {
link: function(scope, elem, attrs, ctrl) {
scope.presentation.sources.maxR_Source = {
"Hours": "4",
"Minutes": "5",
"Seconds": "6"
};
}
};
});
我想最初选择“Minutes”选项。我该怎么做?
请帮忙, 感谢。
答案 0 :(得分:0)
在控制器中,设置$scope.properties.maxRetries.type = 'Minutes'
。然后你的ng-model将获取值并将其应用于选项。