Angularjs 生产服务器上出现Firebase错误,开发人员正常。使用角火
我认为下面的问题是由于我加载firebase数据的方式造成的,因为将数据调用放入SetTimeout中会对dev服务器产生影响,但这对生产服务器没有帮助,即使超时设置得很高 完美工作的开发版本在gh页面上出现中断。我已经使用http服务器和works测试了生产版本。但是,一旦gh pages获得它,就会在var indexRef=new FirebaserefString;,上引发以下错误: 错误:新建Firebase失败:第一个参数必须是有效的Firebase URL和路径不能包含.、$、[、或] 这是我的,这是我的 也能够通过Firebase自己的主机重现gh页面上出现的错误Angularjs 生产服务器上出现Firebase错误,开发人员正常。使用角火,angularjs,firebase,angularfire,Angularjs,Firebase,Angularfire,我认为下面的问题是由于我加载firebase数据的方式造成的,因为将数据调用放入SetTimeout中会对dev服务器产生影响,但这对生产服务器没有帮助,即使超时设置得很高 完美工作的开发版本在gh页面上出现中断。我已经使用http服务器和works测试了生产版本。但是,一旦gh pages获得它,就会在var indexRef=new FirebaserefString;,上引发以下错误: 错误:新建Firebase失败:第一个参数必须是有效的Firebase URL和路径不能包含.、$、[、
angular.module('metal01').controller('LandingCtrl', ['$scope', '$firebase', 'Firebase', '$window', '$location' , function($scope, $firebase, Firebase, $window, $location){
// get host url and format to match db index key
var location = $location.host();
location.toLowerCase().replace(/'+/g, '').replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '');
// getting firebase reference for host url index
var refString = "https://tezt.firebaseio.com/metal/index/domains/"+ location;
// This is throwing error!
var indexRef = new Firebase(refString);
var indexSync = $firebase(indexRef);
var indexArray = indexSync.$asArray();
var indexObject = indexSync.$asObject();
setTimeout(function(){
// create firebase objects in timeout to avoid undefined while loading.
var domainRef = 'https://tezt.firebaseio.com/metal/domains/'+indexObject.$value;
var ref = new Firebase(domainRef);
var sync = $firebase(ref);
var mediaSync = $firebase(mediaRef);
$scope.data = sync.$asObject();
$scope.list = sync.$asArray();
$scope.media = mediaSync.$asArray();
$scope.height = $window.innerHeight;
$scope.location = $location.host();
},2000);
var mediaRef = new Firebase("https://tezt.firebaseio.com/metal/media/");
}]);
你能给我plunker/jsfiddle/codepen在哪里可以查到这个吗?@CrazyGeek当然。。其思想是,该应用程序获取当前域名,对照引用特定域数据的索引域名列表进行检查。如果格式化后匹配,则会返回站点数据。谢谢,我了解了您的想法,并将尝试以非常优化的方式进行解析,以帮助您:谢谢你,巴德!我试图将firebase调用放入服务中,并通过resolve属性注入状态控制器,但仍然遇到相同的错误。我可能没有正确使用$q。。