最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught ReferenceError : angular is not defined (Using testem) - Stack Overflow

programmeradmin4浏览0评论

Error is found in line 1 of 2 files: - controllers.js - app.js

Which is attached below together with 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?

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.

index.html file

<!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=".js"></script> <!-- firebase -->
    <script src=".5.0/angularfire.min.js"></script> <!-- angularfire -->
    <script src=".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)

angular.module('bucketList.controllers', [])
    .controller('SignInCtrl', [
        '$scope', '$rootScope', '$firebaseAuth', '$window',

app.js file (Error in first line)

angular.module('bucketList', ['ionic', 'firebase', 'bucketList.controllers'])

Error is found in line 1 of 2 files: - controllers.js - app.js

Which is attached below together with 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?

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.

index.html file

<!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./v0/firebase.js"></script> <!-- firebase -->
    <script src="https://cdn.firebase./libs/angularfire/0.5.0/angularfire.min.js"></script> <!-- angularfire -->
    <script src="https://cdn.firebase./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)

angular.module('bucketList.controllers', [])
    .controller('SignInCtrl', [
        '$scope', '$rootScope', '$firebaseAuth', '$window',

app.js file (Error in first line)

angular.module('bucketList', ['ionic', 'firebase', 'bucketList.controllers'])
Share Improve this question edited Nov 24, 2014 at 13:54 Thinkerer asked Jul 6, 2014 at 7:33 ThinkererThinkerer 1,6266 gold badges23 silver badges43 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

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.

So add a reference for angularjs before app.js and controller.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

          angular.module('bucketList', [])
           .controller('SignInCtrl', [
                      '$scope', '$rootScope', '$firebaseAuth', '$window',
                       function($scope, $rootScope, $firebaseAuth, $window) {
                       $rootScope.checkSession();

                         $scope.user = {
                                  email: "",
                                    password: ""
发布评论

评论列表(0)

  1. 暂无评论