我在Firebase上有以下结构。
+Groups
-group1
-groupMessage: abc
-groupName: xyz
-members
-User1 = STATUS: "true"
-User2 = STATUS: "pending"
+group2
+group3
etc..
+Users
-User1
-Groups
-group1 = STATUS: "true"
-group3 = STATUS: "pending"
etc..
+User2
+User3
etc..
我正在尝试根据个人用户是否具有“真实”或“待处理”状态来显示群组信息。我的应用程序具有“待定”和“真实”状态的单独页面视图。
以下是我试图实现这一目标的方法。
.controller('GroupCtrl', function($scope, $firebaseObject, $rootScope) {
// Get a reference to the Firebase account
var fbRef = new Firebase("https://####.firebaseio.com/");
// Get a reference to where the User's Group IDs are stored
var fbUserCircle = new Firebase(fbRef + "/Users/" + $rootScope.fbAuthData.uid + "/Groups/");
var fbCircles = new Firebase(fbRef + "/Groups/");
var obj = $firebaseObject(fbUserCircle.orderByChild("Status").equalTo("pending"));
obj.$loaded().then(function() {
console.log("loaded record:", obj.$id);
// Iterating the key/value pairs of the object
angular.forEach(obj, function(value, key) {
var groupObj = $firebaseObject(fbCircles.child(key));
console.log("$ref: " + circlesObj.$ref());
circlesObj.$loaded().then(function() {
circlesObj.$bindTo($scope, "groups");
})
})
})
})
在我的网页浏览量中,我正在尝试为{{groups.groupName}}
上的{{groups.groupMessage}}
和具有“待定”状态的群组的用户展示ng-repeat
和 <div role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist" id="myTab">
<li role="presentation" class="active"><a
href="#siteUser" aria-controls="SiteUser" role="tab"
data-toggle="tab">Site/User</a></li>
<li role="presentation"><a href="#isp"
aria-controls="ISP" role="tab" data-toggle="tab">ISP</a></li>
<li role="presentation"><a href="#country"
aria-controls="Country" role="tab" data-toggle="tab">Country</a></li>
<li role="presentation"><a href="#studioDefault"
aria-controls="StdioDefault" role="tab" data-toggle="tab">Studio
Default</a></li>
</ul>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="siteUser">
<br>
<table
class="table table-striped table-bordered table-hover table-condensed" id="t1">
<thead>
<tr>
<th>#</th>
<th>SiteName</th>
<th>UserName</th>
<th>Channel</th>
<th>Action</th>
</tr>
</thead>
<tbody id="site-table-body">
<tr>
<td class="beer"></td>
<td>
<select class="form-control"><option>www.google.com</option>
<option>www.yahoo.com</option>
<option>www.flipkart.com</option>
<option>www.gamil.com</option></select></td>
<td id="personalTd"><input type="checkbox" value="user"><input type="text" class="and" placeholder="Enter the User Name"/></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr><tr id="add-template">
<td class="beer"></td>
<td>
<select class="form-control"><option>www.google.com</option>
<option>www.yahoo.com</option>
<option>www.flipkart.com</option>
<option>www.gamil.com</option></select></td>
<td><input type="checkbox" value="user"><input type="text" class="and" placeholder="Enter the User Name"/></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
</tbody>
</table>
<div class="form-group nextButton">
<button type="button" id="nextSiteUser"
class="btn btn-success btn btn-xs">Next</button>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="isp">
<br>
<table
class="table table-striped table-bordered table-hover table-condensed" id="t2">
<thead>
<tr>
<th>#</th>
<th>ISP</th>
<th>Channel</th>
<th>Action</th>
</tr>
</thead>
<tbody id="isp-table-body">
<tr>
<td class="beer"></td>
<td><select class="form-control"><option>Vodafone</option>
<option>Airtel</option>
<option>BSNL</option>
<option>Aircel</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
<tr id="add-template">
<td class="beer"></td>
<td><select class="form-control"><option>Vodafone</option>
<option>Airtel</option>
<option>BSNL</option>
<option>Aircel</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
</tbody>
</table>
<div class="form-group nextButton">
<button type="button" id="nextIsp" class="btn btn-success btn btn-xs"
value="submit">Next</button>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="country">
<br>
<table
class="table table-striped table-bordered table-hover table-condensed" id="t3">
<thead>
<tr>
<th>#</th>
<th>Country</th>
<th>Channel</th>
<th>Action</th>
</tr>
</thead>
<tbody id="country-table-body">
<tr>
<td class="beer"></td>
<td><select class="form-control"><option>Country</option>
<option>IN</option>
<option>UK</option>
<option>US</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
<tr id="add-template">
<td class="beer"></td>
<td><select class="form-control"><option>Country</option>
<option>IN</option>
<option>UK</option>
<option>US</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
</tbody>
</table>
<div class="form-group nextButton">
<button type="button" id="nextCountry" class="btn btn-success btn btn-xs"
value="submit">Next</button>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="studioDefault">
<br>
<table
class="table table-striped table-bordered table-hover table-condensed" id="t4">
<thead>
<tr>
<th>#</th>
<th>Studio Default</th>
<th>Channel</th>
<th>Action</th>
</tr>
</thead>
<tbody id="studio-default-table-body">
<tr>
<td class="beer"></td>
<td><select class="form-control"><option>www.google.com</option>
<option>www.yahoo.com</option>
<option>www.flipkart.com</option>
<option>www.gamil.com</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr><tr id="add-template">
<td class="beer"></td>
<td>
<select class="form-control"><option>www.google.com</option>
<option>www.yahoo.com</option>
<option>www.flipkart.com</option>
<option>www.gamil.com</option></select></td>
<td><input type="text" class="form-control" placeholder="Enter the Channel"/></td>
<td><span class="glyphicon glyphicon-plus" id="add-row"></span> <span class="glyphicon glyphicon-trash row-remover"></span></td>
</tr>
</tbody>
</table>
<div class="form-group nextButton">
<button type="button" id="finish" class="btn btn-success btn btn-xs"
value="submit">Finish</button>
</div>
</div>
</div>
。
我的视图中没有显示数据,用于显示具有“待定”状态的用户组。我究竟做错了什么?任何人都知道更好的方法吗?