很抱歉打扰你,我已经彻底搜索过了,但我已经积极尝试解决这个问题超过20个小时了。我即将放弃使用angularjs和firebase。我就是想不通..
我尝试将数组中的数据库值添加到页面中。它适用于其他数据,但不适用于此。
我的firebase数据库:
我已经包括了免费下注相关的代码,这是所有的好,但博彩deatils只是不会工作。在数组中还有其他的博彩细节,我也只是想让它正常工作。
myApp.controller('BetsController',
['$scope', '$rootScope', '$location', '$routeParams', '$firebaseObject', '$firebaseArray',
function($scope, $rootScope, $location, $routeParams, $firebaseObject, $firebaseArray) {
//Values passed throu routeparams are assigned to variables and then used to search the firebase database.
var ref, freeBetList, test;
$scope.whichoffer = $routeParams.oId;
$scope.whichuser = $routeParams.uId;
ref = firebase.database().ref()
.child('users').child($scope.whichuser)
.child('offers').child($scope.whichoffer)
.child('freeBets');
freeBetList = $firebaseArray(ref);
$scope.freeBets = freeBetList;
test = firebase.database().ref()
.child('users').child($scope.whichuser)
.child('offers');
//.child('offerbookie')
// testing = $firebaseObject(test);
testing = $firebaseArray(test);
$scope.test = testing;
<div class="card meetings cf">
<h2>Free Bets</h2>
<div class="meeting" ng-repeat="(key, freeBets) in freeBets">
<a href="#">
<span class="text">{{freeBets.eventname}}</span>
</a>
<button class="btn btn-delete tooltip"
ng-click="deleteOffer(key)"><span>Delete this offer</span></button>
</div>
</div>
<div class="card meetings cf">
<h2>Offer Details</h2>
<div class="meeting" ng-repeat="(key, value) in test">
<a href="#">
<p>{{whichoffer.offerbookie}}</p>
</a>
</div>
</div>
Console.log:
[]
"$$added": function added()
"$$error": function error()
"$$getKey": function getKey()
"$$moved": function moved()
"$$notify": function notify()
"$$process": function process()
"$$removed": function removed()
"$$updated": function updated()
"$add": function add()
"$destroy": function destroy()
"$getRecord": function getRecord()
"$indexFor": function indexFor()
"$keyAt": function keyAt()
"$loaded": function loaded()
"$ref": function ref()
"$remove": remove()
length: 1
name: "bound $remove"
__proto__: function ()
"$resolved": true
"$save": function save()
"$watch": function watch()
0: Object { date: 1529091671870, offerbookie: "Coral", offermarket: "Betfair", … }
1: Object { date: 1529150480309, offerbookie: "SkyBet", offermarket: "Smarkets", … }
length: 2
__proto__: Array []
bets.js:42:4
我只想显示一个与$scope.whichoffer
相关的Offerbookie值。
当前输出:
https://stackoverflow.com/questions/50897988
复制相似问题