I get "ReferenceError: angular is not defined". The funny thing is, I copied the structure of my app from another working Webapp I made and just changed the names so far, I have no idea what I may have changed that causes trouble now.
I double checked the order of the script tags and tried every other solution I found but nothing's worked so far.
This is my HTML:
<!DOCTYPE html>
<html lang="de" ng-app="VetCare">
<head>
<title>Vet & Care Webapp</title>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow">
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Vet & Care">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-cookies.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.min.js"></script>
</head>
<body>
<div id="content" ng-controller="MainCtrl" ng-init="redirect()">
<div ng-view autoscroll="true"></div>
</div>
<script src="js/app.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
</body>
</html>
And my module and MainCtrl in app.js:
var app = angular.module('VetCare', ['ngCookies', 'ngRoute', 'ngAnimate', 'ui.bootstrap']);
app.controller('MainCtrl', ['$scope', '$cookies', '$window', function($scope, $cookies, $window) {
$scope.redirect = function () {
//some code
};
}]);
Have you tried moving the scripts from <head>
to above the app.js
at the end of body
?
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-cookies.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
<script src="js/app.js"></script>
</body>
If that doesn't help, do you get the correct response from loading angular.min.js
in network tab in developer tools ?