我正在开设Apps for Apps项目。我已经能够为其添加外部API,但无法从Firebase获取数据。
我通过终端通过npm安装了firebase和angularFire。我是否需要加入' firebase'在app.js中的应用程序?还是在$ inject bellow中的任何东西?
那里有没有这方面的文件?
JSON文件的屏幕截图: http://i.imgur.com/QQ5G5aF.png?1
app.js
(function() {
'use strict';
angular.module('application', [
'ui.router',
'ngAnimate',
'firebase',
'foundation',
'foundation.dynamicRouting',
'foundation.dynamicRouting.animations'
])
.controller("PostListCtrl", function($scope, $firebaseArray) {
var ref = new Firebase("https://emailangular.firebaseio.com/posts");
$scope.posts = $firebaseArray(ref);
})
.config(config)
.run(run)
;
config.$inject = ['$urlRouterProvider', '$locationProvider'];
function config($urlProvider, $locationProvider) {
$urlProvider.otherwise('/');
$locationProvider.html5Mode({
enabled:false,
requireBase: false
});
$locationProvider.hashPrefix('!');
}
function run() {
FastClick.attach(document.body);
}
})();
blog.html
---
name: blog
url: /blog
title: Blog
controller: PostListCtrl
---
<div class="post" ng-repeat="post in posts">
<h3><a href="#">{{post.title}}</a></h3>
<p>{{post.timestamp}}<p>
<p>{{post.body}}</p>
</div>
提前致谢! -Ken