3
I’m starting to test applications using Angularjs and Spring Boot.
My problem is this: All scripts are normally imported into the browser, but IF I tag "ng-controller="Headcontroller"" on any tag on my page, I have an error saying that "Headcontroller" is not a function.
My HTML code is as follows::
<!DOCTYPE HTML>
<html ng-app lang="pt-br">
<head>
<title>{{title}}</title>
<meta charset="utf-8"/>
</head>
<body ng-controller="HeadController">
<p>Qual seu nome?</p>
<input type="text" ng-model="name">
<p>Olá, <span ng-bind="name"></span></p>
<script type="text/javascript" src="../scripts/angular.min.js"></script>
<script type="text/javascript" src="../scripts/angular-route.js"></script>
<script type="text/javascript" src="../scripts/jquery-2.2.1.min.js"></script>
<script type="text/javascript" src="../scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="../scripts/main.js"></script>
<script type="text/javascript" src="../scripts/controllers/HeadController.js"></script>
</body>
</html>
CSS:
<link rel="stylesheet" src="../css/bootstrap-min.css">
<link rel="stylesheet" src="../css/bootstrap-theme-min.css">
My main.js is:
angular.module('mod', ['ngRoute', 'HeadController']);
My Headcontroller is:
angular.module('mod').controller('HeadController', function($scope, $http) {
$scope.title = 'titulo';
});
All scripts are correctly imported into the page. I use Freemarker as template engine.
The problem I find is this:: Error
Someone would know to help me with that?
Thank you in advance,
Have you tried loading scripts before body?
– Vinicius Zaramella