Zaid Mirza Zaid Mirza -4 years ago 174
AngularJS Question

Angular debugging using Firebug

I´m making an AngularJS app, which fetches data from the Firebase cloud. The data is shown on page but when I debug my controller, it shows an empty list of articles. Why is my variable shown as empty during debugging?

Here is the code of my controller:

appMainModule.controller('GetCtrl', ['$scope', '$firebaseArray', function ($scope, $firebaseArray) {
var firebaseObj = new Firebase("URL")
//var sync = $firebaseArray(firebaseObj);
//$scope.articles = sync.$asArray();
$scope.articles = $firebaseArray(firebaseObj);

var firebaseObj1 = new Firebase("URL");

$scope.articles1 = $firebaseArray(firebaseObj1.orderByChild("Month").equalTo("Apr-2016"));
var query=$scope.articles1
var num = query.length;

And here is my HTML code:

<div class="content" style="height: 380px; overflow: auto;">
<table class="table">
<th>Incident Name</th>
<tbody ng-repeat="article in articles1 ">

Within the HTML page
is providing the data, but within the controller it is shown as empty after fetching the data.

Answer Source

I solved my problem, I was expecting my data so early as it was asyncrounous call to firebase. so here is the method when firebase returns a promise for data

// do here with data,what you want
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download