Error is found in line 1 of 2 files: - controllers.js - app.js
在2个文件的第1行中发现错误:-控制器。js - app.js
Which is attached below together with html.
它与html一起附加在下面。
The app appears when I start up local server but I am unable to login or signup by clicking the sign up button after entering my details. Is it a 404 error?
当我启动本地服务器时,应用程序会出现,但在输入详细信息后,我无法登录或注册。是404错误吗?
I also tried to add these 2 lines into the index.html file (I thought was some items I didnt define) but did not work.
我还尝试将这两条线加入索引。html文件(我认为是一些我没有定义的项目)但是没有起作用。
index.html file
索引。html文件
<!DOCTYPE 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>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
*<!-- ionic/angularjs js -->*
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script> <!-- firebase -->
<script src="https://cdn.firebase.com/libs/angularfire/0.5.0/angularfire.min.js"></script> <!-- angularfire -->
<script src="https://cdn.firebase.com/v0/firebase-simple-login.js"></script> <!-- firebase-simple-login -->
*<!-- cordova script (this will be a 404 during development) -->*
<script src="cordova.js"></script>
<!-- app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="bucketList" animation="slide-left-right-ios7">
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-chevron-left">
Back
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
</html>
controllers.js file (Error in first line)
控制器。js文件(第一行错误)
angular.module('bucketList.controllers', [])
.controller('SignInCtrl', [
'$scope', '$rootScope', '$firebaseAuth', '$window',
app.js file (Error in first line)
js文件(第一行错误)
angular.module('bucketList', ['ionic', 'firebase', 'bucketList.controllers'])
2 个解决方案
#1
7
The error says, you are attempt to use angular
before load the script. I didn't see any reference of angularjs
library in your index.html
file.
错误说,在加载脚本之前,您尝试使用角。我没有看到您索引中的angularjs库的任何引用。html文件。
So add a reference for angularjs
before app.js
and controller.js
.
因此在app.js和controller.js之前为angularjs添加一个引用。
#2
1
App.js
App.js
angular.module('bucketList', ['ionic', 'firebase'])
.run(function($ionicPlatform, $rootScope, $firebaseAuth, $firebase, $window, $ionicLoading) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
controller.js
controller.js
angular.module('bucketList', [])
.controller('SignInCtrl', [
'$scope', '$rootScope', '$firebaseAuth', '$window',
function($scope, $rootScope, $firebaseAuth, $window) {
$rootScope.checkSession();
$scope.user = {
email: "",
password: ""
#1
7
The error says, you are attempt to use angular
before load the script. I didn't see any reference of angularjs
library in your index.html
file.
错误说,在加载脚本之前,您尝试使用角。我没有看到您索引中的angularjs库的任何引用。html文件。
So add a reference for angularjs
before app.js
and controller.js
.
因此在app.js和controller.js之前为angularjs添加一个引用。
#2
1
App.js
App.js
angular.module('bucketList', ['ionic', 'firebase'])
.run(function($ionicPlatform, $rootScope, $firebaseAuth, $firebase, $window, $ionicLoading) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
controller.js
controller.js
angular.module('bucketList', [])
.controller('SignInCtrl', [
'$scope', '$rootScope', '$firebaseAuth', '$window',
function($scope, $rootScope, $firebaseAuth, $window) {
$rootScope.checkSession();
$scope.user = {
email: "",
password: ""