muzi jack muzi jack - 2 years ago 141
AngularJS Question

i want to assign a snapshot.val() to to $scope variable $scope.pending and bind it to a ng-repeat list

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"}

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

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

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

.controller('pendingTasksCtrl', function($scope,$firebaseArray,$firebaseObject,$rootScope,$ionicModal)

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

var itemref = new Firebase("");
//$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("**************find me "+itemref.orderByChild("status").equalTo("task").on("child_added"));


Answer Source
var itemref = new Firebase("");
   var taskref = itemref.orderByChild("status").equalTo(true);
     taskref.on("value", function(response) {
     $scope.filterTasks = response.val();

That works perfectly

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download