我通过 Thinkster IO 教程创建了我的第一个 Angular 应用程序,并希望将应用程序部署到 Firebase。我已经运行firebase init
and firebase deploy
,两者都运行成功。
从 firebase 打开应用程序时,页面加载但不显示任何内容。打开 JS 控制台出现三个错误
错误是:
1) [阻止] ' https://ngfantasyfootball.firebaseapp.com/ ' 的页面是通过 HTTPS 加载的,但运行来自 ' http://static.firebase.com/v0/firebase.js ' 的不安全内容:此内容也应该通过 HTTPS 加载。
2) Uncaught ReferenceError: Firebase is not defined angularFire.js:17
3)未捕获的错误:[$injector:unpr] 未知提供者:angularFireAuthProvider <- angularFireAuth angular.js:60
关于如何解决第一个错误的任何想法?第二个,Firebase is not defined
说它来自 angularFire 脚本?该应用程序在本地运行而没有任何错误,所以我不确定为什么会出现这种情况。
第三个错误,angularFireAuthProvider。我已经看到一些关于使用 simpleLogin 而不是 angularFireAut 的问题的答案,但我不确定这是否是错误的根源。任何帮助都会很棒,我已经为此苦苦挣扎了一段时间。
配置.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/')
应用程序.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']
)