该项目的目标是在网站中显示 Oracle PL/SQL 记录。我使用了以下教程(http://daptik.github.io/blog/2013/07/13/angularjs-example-using-a-java-restful-web-service/)来建立与数据库的连接. 我能够存储和显示单个记录的值,但在添加更多记录时不能。
Sample JSON Information
[
{ "firstName":"FN1",
"lastName":"LN1",
"email":null,
"createdBy":-1,
"createdDate":"2013-09-24"
},
{ "firstName":"FN2",
"lastName":"LN2",
"email":null,
"createdBy":-1,
"createdDate":"2013-09-24"
},
{ "firstName":"FN3",
"lastName":"LN3",
"email":null,
"createdBy":-1,
"createdDate":"2013-09-24"
},
{ "firstName":"FN4",
"lastName":"LN4",
"email":null,
"createdBy":-1,
"createdDate":"2013-09-24"
},
{ "firstName":"FN5",
"lastName":"LN5",
"email":null,
"createdBy":-1,
"createdDate":"2013-09-24"
}
]
该示例使用了一个工厂,我确信它保存了来自 json 的数据,但我不能让它存储多于一条记录。理想情况下,我将能够像在此示例中那样循环浏览记录:http: //jsfiddle.net/pJ5BR/124/。
我将不胜感激任何建议。这些是当前定义工厂的方式。
services.js:
services.factory('QueryFactory', function ($resource) {
return $resource('/Query/rest/json/queries/get', {}, {
query: {
method: 'GET',
params: {},
isArray: false
}
});
});
controllers.js:
app.controller('MyCtrl1', ['$scope', 'QueryFactory', function ($scope, QueryFactory) {
QueryFactory.get({}, function (QueryFactory) {
$scope.firstName = QueryFactory.firstName;
});
}]);