1

I tried to fetch data from my firebase account

var myApp = angular.module('myApp',['firebase']);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

myApp.factory("Items", function($firebaseArray) {
  var itemsRef = new Firebase("https://tukang-urut-dayang.firebaseio.com/senarai_pelanggan");
  return $firebaseArray(itemsRef);
})
function MyCtrl($scope,Items) {
   $scope.items = Items;

}

Unfortunately the return of Items does not give any outputs at all. Did I miss something?

I just follow this tutorial

https://www.firebase.com/docs/web/libraries/ionic/guide.html#section-list-view


Fiddle

2
  • Have you followed the authentication instructions in the tutorial? Commented Dec 12, 2016 at 13:04
  • Does it affected the resilt? Commented Dec 12, 2016 at 13:09

1 Answer 1

2

You're using some incompatible versions of the libraries.

I updated your jsfiddle to use these includes:

https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js
https://cdn.firebase.com/js/client/2.4.0/firebase.js
https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js

And updated the controller definition to:

var myApp = angular.module('myApp',['firebase']);

myApp.factory("Items", function($firebaseArray) {
  var itemsRef = new Firebase("https://tukang-urut-dayang.firebaseio.com/senarai_pelanggan");
  return $firebaseArray(itemsRef);
})
myApp.controller("MyCtrl", function ($scope,Items) {
   $scope.items = Items;
});

With these changes it works.

See the updated fiddle: http://jsfiddle.net/puf/puap07ar/3/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. Where is the specific documentation for this version?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.