3
In a project I’m developing, I’m including the files:
app js.
angular.module('app', [
'app.controllers',
'app.services'
]
controller js.
angular.controller('HomeController', function($scope, HomeService)
{
// code
})
services.js
angular.service('HomeService', function()
{
// code
})
html template.
<html ng-app="app">
<head>
// scripts
</head>
<body ng-controller="HomeController">
// body
</body>
</html>
When I open the page I see the error:
I searched the Google
and in the few researches I found where it was the same mistake I’m having, I couldn’t find a solution to it. Some say that some module or something is missing, but as I showed, everything is inserted and the names are correct.
What could I be doing wrong ?
Complementing the answer: This is possible because
angular.module
returns the module object to which controllers and services will be applied– anisanwesley
But you won’t be able to access
app.controllers
if you have not registered them before, you will give the same error– anisanwesley
Really solved my problem. Thank you!
– tadeubarbosa