/*student.html*/
<!DOCTYPE html>
<html ng-app="">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.2.12.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src= "students.js"></script>
</head>
<body >
<div class="container" ng-controller="userController">
<h3>Students</h3>
<table class="table table-striped">
<thead><tr>
<th>Edit</th>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr></thead>
<tbody><tr ng-repeat="user in users">
<td>
<button class="btn" ng-click="editUser(user.id)">
<span class="glyphicon glyphicon-pencil"></span> Edit
</button>
</td>
<td>{{ user.firstname}}</td>
<td>{{ user.lastname }}</td>
<td>{{ user.age }}</td>
</tr></tbody>
</table>
<hr>
</div>
</body>
</html>
請幫助我我是angularjs的新手,也是第一次使用parse。我被困在顯示查詢結果(這是一個數組使用angularjs..anyone NG重複誰曾碰到過同樣的問題的對象),請貢獻你的答案..如何使用angularjs以表格格式顯示來自parse.com的查詢結果
/*stduents.js*/
function userController($scope) {
var users=[];
Parse.initialize("parseid", "jskey");//parseid and jskey are given in my parse.com account
var student=Parse.Object.extend("student");//student is a class in parse.com
var query=new Parse.Query(student);
query.equalTo("userid",Parse.User.current());
query.find({
success:function(results) {
alert("success");
for(var i=0;i<results.length;i++)
{
var object= results[i];
users.push({'firstname':object.get('firstname') , 'lastname':object.get('lastname') ,'age':object.get('age')});
}
},
error:function(error) {
alert("error:"+ error.code +" "+error.message);
}
});
請添加足夠的代碼和標記片段來演示您嘗試失敗的方法。 – mccainz 2015-03-03 13:37:56
hi @mccainz我已添加代碼片段。請檢查一下。 – Sharathreddy 2015-03-04 01:40:30
http://plnkr.co/edit/sogtgtDrz21pd9p2yXhj?p=preview – Sharathreddy 2015-03-04 12:42:57