我正在使用角度和语义ui。我试图通过选择选项选择Y和N.基本上我只想在页面显示时选择第一个项目。试过很多方法,但我无法使它发挥作用。
请看看这个傻瓜。
angular.module('myapp', [])
.controller('testctrl', function ($scope){
$scope.add = {};
$scope.Consigns = [{value: 'N',label: 'N'}, {value: 'Y',label: 'Y'}];
$scope.add.consign = $scope.Consigns[0].label;
})
.controller('testctrl1', function ($scope){
$scope.add = {};
$scope.Consigns1 = [{value: 'N',label: 'N'}, {value: 'Y',label: 'Y'}];
$scope.add.consign1 = $scope.Consigns1[0].label;
});
答案 0 :(得分:1)
在默认占位符中打印模型值。而不是在label
中发送$scope.add.consign
值,您可以发送整个对象并打印所需的内容。
答案 1 :(得分:0)
javascript:
V[ITM[as.logical(max.col(cbind(CV, ExV))-1)], t] =
SimFieldValue[ITM[as.logical(max.col(cbind(CV,ExV))-1)],t+1]
V[,t] <- ifelse(V[,t]==0,V[,t+1]*exp(-r),V[,t])
HTML:
$scope.ListOrder =
[
{ Name: "price", Id: 1 },
{ Name: "exist", Id: 2 },
{ Name: "Sale", Id: 3 },
{ Name: "New", Id: 4 }
];
$scope.Order = { Name: "exist", Id: 1 };
答案 2 :(得分:0)
删除
<script>
$('.ui.dropdown').dropdown();
</script>
并将select标签更改为此
<select ng-model="add.consign" class="ui fluid dropdown" ng-options="x.label as x.label for x in Consigns">
<option value=""></option>
</select>