我收到以下错误:
**angularfire.min.js:12 Uncaught ReferenceError: angular is not defined
angularfire.min.js:12 Uncaught ReferenceError: angular is not defined
ionic.bundle.js:17697 Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module firebase due to:
Error: [$injector:nomod] Module 'firebase' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.**
在设备中运行离子应用。我通过chrome:// inspect。
得到了上述错误但是应用程序在Web视图(离子服务)中运行良好。
Index.html文件:
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>
<!--script src="angular.min.js"></script-->
<!-- Firebase -->
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "xxxx",
authDomain: "xxxx.firebaseapp.com",
databaseURL: "https://xxxx.firebaseio.com",
storageBucket: "xxxx.appspot.com",
};
firebase.initializeApp(config);
</script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
app.js:
var db = null;
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.directives','app.services','ngCordova','firebase'])
.run(function($ionicPlatform,$cordovaSQLite,$rootScope, $firebaseAuth, $firebase, $window, $ionicLoading,$cordovaGeolocation,$interval) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
controller.js:
angular.module('app.controllers', [])
.controller('mobileCtrl', ['$scope', '$rootScope','$stateParams','SendSMSFactory','VcodeStorageService',// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope,$rootScope,$stateParams,SendSMSFactory,VcodeStorageService) {
我不确定,这里有什么不对。 我尝试通过手动将它们放在js文件夹中并相应地更改链接来替换角度文件的cdn链接。但没有运气。
其他有类似问题的帖子,他们的解决方案是在index.html中添加angular文件。 但我已经拥有它。
请帮忙。