title: Uncaught ReferenceError: app is not defined in Angularjs
body: <p>I got this error. I looked through the answers posted previously but still I have the same problem.</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;html lang="en" ng-app="customersApp"&gt;
  &lt;head&gt;
  
      &lt;link rel="shortcut icon" href="img/favicon.html"&gt;
  
      &lt;title&gt;Vizavoo&lt;/title&gt;
  
      &lt;!-- Bootstrap core CSS --&gt;
      &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
      &lt;link href="css/bootstrap-reset.css" rel="stylesheet"&gt;
       &lt;link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" /&gt;
  
      &lt;!--external css--&gt;
     &lt;link href="css/slidebars.css" rel="stylesheet"&gt;
      &lt;!-- Custom styles for this template --&gt;
      &lt;link href="css/style.css" rel="stylesheet"&gt;
      &lt;link href="css/style-responsive.css" rel="stylesheet" /&gt;
  
  
  &lt;/head&gt;
  
    &lt;body&gt;
  
     &lt;div ng-view&gt;&lt;/div&gt;
  
  
  
      &lt;!-- js placed at the end of the document so the pages load faster --&gt;
         &lt;script src="scripts/angular.js"&gt;&lt;/script&gt; 
         &lt;script src="scripts/angular-route.js"&gt;&lt;/script&gt;
           &lt;script src="app/app.js"&gt;&lt;/script&gt;
           &lt;script src="app/controllers/loginController.js"&gt; &lt;/script&gt;
             &lt;script src="js/jquery.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  
  
    &lt;/body&gt;
  
  &lt;!-- Mirrored from thevectorlab.net/flatlab/login.html by HTTrack Website Copier/3.x [XR&amp;CO'2014], Mon, 08 Dec 2014 06:09:06 GMT --&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>app.js</p>
  
  <pre><code>(function(){
  
  var app= angular.module('customersApp',['ngRoute']);
  
  app.config(['$routeProvider',
    function ($routeProvider) {
          $routeProvider.
          when('/login', {
              title: 'Login',
              controller: 'loginController',
                 templateUrl: 'app/views/loginuser.html'
          })
              .when('/logout', {
                  title: 'Logout',
                  templateUrl: 'partials/login.html',
                  controller: 'loginController'
              })
  
              .when('/dashboard', {
                  title: 'Dashboard',
                  templateUrl: 'app/views/dynamic_table.html',
                  controller: 'loginController'
              })
              .when('/signup', {
                  title: 'Signup',
                  templateUrl: 'app/views/registration.html',
                  controller: 'loginController'
              })
  
              .otherwise({
                  redirectTo: '/login'
              });
    }]);
  
  }());
  </code></pre>
  
  <p>loginController.js</p>
  
  <pre><code>app.controller('loginController', function ($scope,$http, Data) {
      //initially set those objects to null to avoid undefined error
      $scope.login = {};
      $scope.signup = {};
      $scope.doLogin = function (customer) {
  
  
          $.post("http://dev.miniluxe.com:4002/email_login",
    {
  
       email : $scope.login.email,
        password : $scope.login.password
    },
    function(data,status){
  
  
        data = JSON.parse(data);
        console.log(data);
  
        if(data.log==1)
        {
  
            // window.location.href = "dashboard";
             $location.path('dashboard');
        }
        else
        {
  
  
           alert("wrong username and password");
        }
  
  
    });
  
  
      };
  
      $scope.logout = function () {
          Data.get('logout').then(function (results) {
              Data.toast(results);
              $location.path('login');
          });
      }
      app.filter('startFrom', function() {
      return function(input, start) {
          if(input) {
              start = +start; //parse to int
              return input.slice(start);
          }
          return [];
      }
  });
  
  
  
  
  
  
  });
  </code></pre>
  
  <p>Please check the code and tell me where I am making a mistake.</p>