我已经通过Thinkster IO教程创建了我的第一个角度应用程序之一,并且希望将应用程序部署到Firebase。我运行了firebase init
和firebase deploy
,两者均成功运行。角度(使用Firebase)应用程序部署到Firebase问题
从firebase打开应用程序时,页面加载但不显示任何内容。在打开JS控制台有三个误差
的错误是:
1) [阻断该在“https://ngfantasyfootball.firebaseapp.com/”装载在HTTPS上,而是跑到从“http://static.firebase.com/v0/firebase.js”不安全的内容页:这个内容也应该通过HTTPS加载。
2)未捕获的ReferenceError:未定义火力地堡angularFire.js:17
3)未被捕获的错误:[$注射器:unpr]未知提供商:angularFireAuthProvider < - angularFireAuth angular.js:60
关于如何解决第一个错误的任何想法?第二个,Firebase is not defined
说它来自angularFire脚本?该应用程序在本地运行没有任何错误,所以我不确定为什么会出现这种情况。
第三个错误,angularFireAuthProvider。我见过一些问题,有关使用simpleLogin而不是angularFireAut的答案,但我不确定这是否是错误的根源。任何帮助都会很好,现在我一直在努力。
Config.JS
'use strict';
angular.module('fantasyApp.config', [])
app.config(['$routeProvider',
function($routeProvider) {
$routeProvider
.when('/', { templateUrl: 'views/default.html' })
.when('/signin', { templateUrl: 'views/users/signin.html' })
.when('/signup', { templateUrl: 'views/users/signup.html' })
.when('/nflteams', { templateUrl: 'views/nfl/list.html', authRequired: true })
.when('/nflteams/:nflTeamId', { templateUrl: 'views/nfl/view.html', authRequired: true })
.when('/leagues', { templateUrl: 'views/leagues/list.html', authRequired: true })
.when('/leagues/create', { templateUrl: 'views/leagues/edit.html', authRequired: true })
.when('/leagues/:leagueId', { templateUrl: 'views/leagues/view.html', authRequired: true })
.when('/leagues/:leagueId/edit', { templateUrl: 'views/leagues/edit.html', authRequired: true })
.when('/players', { templateUrl: 'views/players/list.html', authRequired: true })
.when('/players/:playerId', { templateUrl: 'views/players/view.html', authRequired: true })
.when('/fantasyteams', { templateUrl: 'views/fantasyteams/list.html', authRequired: true})
.when('/fantasyteams/create', { templateUrl: 'views/fantasyteams/edit.html', authRequired: true})
.when('/fantasyteams/:fantasyTeamId', { templateUrl: 'views/fantasyteams/view.html', authRequired: true})
.when('/fantasyteams/:fantasyTeamId/edit', { templateUrl: 'views/fantasyteams/edit.html', authRequired: true})
.otherwise( { redirectTo: '/' });
}])
// establish authentication
.run(['angularFireAuth', 'FBURL', '$rootScope',
function(angularFireAuth, FBURL, $rootScope) {
angularFireAuth.initialize(new Firebase(FBURL), {scope: $rootScope, name: 'auth', path: '/signin'});
$rootScope.FBURL = FBURL;
}])
.constant('FBURL', 'https://ngfantasyfootball.firebaseio.com/')
app.js
'use strict';
// Declare app level module which depends on filters, and services
var app = angular.module('fantasyApp',
[ 'fantasyApp.config'
, 'fantasyApp.controllers.header'
, 'fantasyApp.controllers.signin'
, 'fantasyApp.controllers.signup'
, 'fantasyApp.controllers.nfl'
, 'fantasyApp.controllers.leagues'
, 'fantasyApp.controllers.players'
, 'fantasyApp.controllers.fantasyTeams'
, 'firebase', 'ui.bootstrap', 'ngRoute']
)
你的应用通过HTTP加载''http:// static.firebase.com/v0/firebase.js''。你可能在你的HTML的HEAD中有它。从URL中删除'http:',并且可以在本地和Firebase的托管服务器上正常工作。所以这是包含在我的一个Firebase托管应用程序中' – 2014-09-04 14:43:53
谢谢,我会在我回到了我的电脑。有一件事我不确定是否值得一提,但应用程序在本地运行良好'node scripts/web-server.js' – 2014-09-06 11:01:15
这工作弗兰克,改变''http://static.firebase.com/v0/ firebase.js''到''https:// static.firebase.com/v0/firebase.js''让它起作用。谢谢 – 2014-09-06 11:38:40