我已經通過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