i want to assign a snapshot.val() to to $scope variable $scope.pending and bind it to a ng-repeat list
<pre><code>     firebase  logged data

Object {information: "way", status: "pending", title: "killa"}
controllers.js:43 Object {information: "way", status: "pending", title: "killa"}
controllers.js:42 Object {information: "way", status: "pending", title: "killa2"}
controllers.js:43 Object {information: "way", status: "pending", title: "killa2"}
</code></pre>



<p>i dont seem to get the list of items im fetching from firebase but im able to log it.</p>

<pre><code>&lt;ion-list  ng-controller="pendingTasksCtrl"&gt;
              &lt;ion-item ng-click="task.completed = !task.completed" class="item-icon-right"  ng-repeat="p in pending"&gt;{{p.title}}{{p.information}}
                &lt;i class="icon ion-ios-arrow-left"&gt;&lt;/i&gt;
                &lt;ion-option-button class="ion-trash-a" ng-click="removeItem($index,1)"&gt;
                &lt;/ion-option-button&gt;
                 &lt;ion-option-button ng-controller="editTaskCtrl" class="ion-edit" ng-click="modal.show()"&gt;
                 &lt;/ion-option-button&gt;
               &lt;/ion-item&gt;
                &lt;/ion-list&gt;
</code></pre>

<p>i want to assign snapshot to a $scope.pending and bind it on front end. but im getting an undefined error</p>

<pre><code>.controller('pendingTasksCtrl', function($scope,$firebaseArray,$firebaseObject,$rootScope,$ionicModal)
{

  var task = "AllTasks";
  var id =0;

            var itemref = new Firebase("https://tasksbylima.firebaseio.com/");
            //$scope.items = $firebaseArray(itemref);
            //var status = "completed";

            $scope.test = function()
            {
            itemref.orderByChild("status").equalTo("pending").on("child_added", function(snapshot)
             {
               $scope.pending = snapshot.val();

                console.log(snapshot.val());
                console.log(pending);

          //  console.log("**************find me "+itemref.orderByChild("status").equalTo("task").on("child_added"));
          });

}
})
</code></pre>