我已经为一个名为
的对象分配了一个数组processMapAttrib.auditNotifyUsers.unAssignedUsers
当我使用
在HTML文件中打印变量时<label>{{processMapAttrib.auditNotifyUsers.unAssignedUsers}}</label>
我得到了
[{"id":230,"name":"Parthiban V"},{"id":231,"name":"Kanna A"},{"id":252,"name":"jagadesh S"},{"id":253,"name":"saravana kumar"},{"id":346,"name":"sith user"},{"id":347,"name":"seventh user"},{"id":348,"name":"unlimited user"}]
processMapAttrib也有其他值。比如processMapAttrib.Process = {},processMapAttrib.task = {},......
但是当我在ng-repeat中使用它时,它就不起作用了。
<select multiple="multiple">
<option value="{{list.id}}" ng-repeat="list in processMapAttrib.auditNotifyUsers.unAssignedUsers">{{list.name}}</option>
</select>
请帮助我将数据填充到选择选项中。
答案 0 :(得分:0)
我建议您使用NgOptions代替NgRepeat,易于使用,并且是一个很好的指令,可以在select元素中动态生成选项元素列表
将此添加到您的视图
java.sql.SQLException: ORA-01722: invalid number
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
at com.Futronic.WorkedEx.SaveDataToDatabase.saveFingerToDatabase(SaveDataToDatabase.java:43)
at com.Futronic.WorkedEx.DbRecord.Save(DbRecord.java:184)
at com.Futronic.WorkedEx.MainForm.OnEnrollmentComplete(MainForm.java:159)
at com.futronic.SDKHelper.FutronicEnrollment.run(FutronicEnrollment.java:234)
at java.lang.Thread.run(Thread.java:745)
请参阅plunker here
答案 1 :(得分:0)
最后我在代码中发现了问题。我已将value属性更改为ng-value。它的工作正常。
<option ng-value="list.id" ng-repeat="list in processMapAttrib.auditNotifyUsers.unAssignedUsers">{{list.name}}</option>
答案 2 :(得分:-1)
试试这段代码:
var app = angular.module("myApp", [])
app.controller("myCtrl", function ($scope) {
$scope.processMapAttrib = [{
"id": 230,
"name": "Parthiban V"
}, {
"id": 231,
"name": "Kanna A"
}, {
"id": 252,
"name": "jagadesh S"
}, {
"id": 253,
"name": "saravana kumar"
}, {
"id": 346,
"name": "sith user"
}, {
"id": 347,
"name": "seventh user"
}, {
"id": 348,
"name": "unlimited user"
}]
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<label>{{processMapAttrib}}</label>
<select multiple="multiple">
<option value="{{list.id}}" ng-repeat="list in processMapAttrib">{{list.name}}</option>
</select>
</div>