Angularfire 'Firebase' 未定义 [英] Angularfire 'Firebase' is not defined
问题描述
我正在尝试为我的 Yeoman AngularJS 应用程序设置 firebase、angularfire.我在这里学习了本教程(https://www.firebase.com/tutorial/#教程/角度/0),但是,我不断得到一个
I am trying to setup firebase, angularfire for my Yeoman, AngularJS Application. I followed this tutorial here (https://www.firebase.com/tutorial/#tutorial/angular/0), however, I keep getting a
"app/scripts/controllers/main.js
line 32 col 23 'Firebase' is not defined."
我该如何解决这个问题?
How do I get past this?
这是我的 main.js
Here is my main.js
.controller('MainCtrl', ['$scope', '$firebase', '$filter', function($scope, $firebase, $filter) {
var ref = new Firebase('FIREBASE_URL'); // <--- line 32
$scope.campaigns = $firebase(ref).$asArray();
这里是我添加的两行脚本,用于将 firebase 和 angularfire 引入我的应用程序.由于 (Firebase、AngularFire 错误:模块 firebase 不可用).我的 index.js 中的 bower_conponents 脚本正下方也有这两行以供参考.
and here are the two lines of scripts I added to get firebase and angularfire into my app. I changed the version of angularfire from 0.8.0 to 0.7.0 because of (Firebase, AngularFire Error: Module firebase is not available). I also have these two lines right underneath by bower_conponents scripts in my index.js for reference.
<script src='https://cdn.firebase.com/js/client/1.0.15/firebase.js'></script>
<script src='https://cdn.firebase.com/libs/angularfire/0.7.0/angularfire.min.js'></script>
我认为这仍然是版本兼容性问题,但我不确定.
I believe it is still version compatibility issue but I am not sure.
推荐答案
Firebase 可能因为这个语法错误而未定义:.$asArray
Firebase is probably undefined because of this syntax error: .$asArray
但是,无论如何,$asArray
在 AngularFire 0.7.0 中不可用.
But, regardless, $asArray
is not available in AngularFire 0.7.0.
这篇关于Angularfire 'Firebase' 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!