Firebase - angular $http
$http - ng
by Pablo Palacios
HTML
<div ng-controller="MyController as vm">
<h1>{{vm.showStuff.name}}</h1>
<pre>{{vm.showStuff | json}}</pre>
<br>
</div>
JavaScript
(function() {
'use strict';
var app = angular.module('app', []);
app.factory('TestingService', TestingService);
function TestingService($http) {
return {
fbCall: fbCall
};
//////
function fbCall() {
return $http.get("https://gtfirebase.firebaseio.com/settings/app.json");
}
}
app.controller('MyController', MyController);
function MyController(TestingService, $scope) {
var vm = this;
console.clear();
TestingService.fbCall().then(function(response) {
vm.showStuff = response.data;
});;
}
})();