我在理解Angular中的下拉功能时遇到了一些麻烦。
我已经尝试过关注StackOverflow上的这些帖子但是我被卡住了:
How can I populate a select dropdown list from a JSON feed with AngularJS?
Angular js Populate dropdown with JSON
我能够填充下拉列表的唯一方法是在每一行中显示所有值(忽略其目的):
+
到目前为止我的代码:
HTML:
<div align = "left" ng-controller='DemoCtrl'>
<select ng-model="tiposProduto" >
<option value="">Selecione o tipo de produto:</option>
<option ng-repeat ="selectedTestAccount in testAccounts" value="item.Id"> {{testAccounts}}>
</select>
</div>
使用Javascript:
<script src="js/app.js"></script>
<script>
app.controller('DemoCtrl', function ($scope, $http) {
$scope.selectedTestAccount = null;
$scope.testAccounts = [];
$http({ method: 'GET', url: '//localhost:8080/RestfulWebservice/rs/service/getTodosTiposProduto'
}).success(function (result) {
$scope.testAccounts = result.tiposProduto;
});
});
</script>
所以,我不确定ng-repeat行应该做什么。如果我尝试在控制台中记录它们,则“items”和“selectedTestAccount”都是未定义的。
范围是这个(testAccount值是我想要填充为行的值):
有人可以帮我一把吗?
答案 0 :(得分:1)
只需在选项中将“selectedTestAccount”放在表达式中。
delete from contacts -- edited
where exists
(
select *
from contacts other
where other.name = contacts.name
and other.number = contacts.number
and other.user_email = contacts.user_email -- decide whether you want this line or not
and other.id < contacts.id
);