i have this code
takings-app.js:
angular
.module("TakingsApp",["ngRoute"])
.config(function($routeProvider){
$routeProvider
.when("/",{
controller: "ListCtrl",
templateUrl:"listTaking.html" //cargar esta vista(templateUrl) con este controlador
})
.when("/edit/:film",{
controller:"EditCtrl",
templateUrl:"editTaking.html"
});
});
console.log("TakingsApp initialized.");
editTaking-control.js:
/* global angular */
angular
.module("TakingsApp")
.controller("EditCtrl",
["$scope",
"$http",
"$routeParams",
"$location",
function ($scope,$http,$routeParams,$location){
console.log("Edit Controller initialized.");
listTaking-ctrl.js:
var app = angular.module("TakingsApp");
app.controller("ListCtrl", ["$scope", "$http", function($scope, $http) {
console.log("ListCtrl initicialized!");
I have put the initializations only of the .js files, since the error is supposedly from the initialization of the module or some controller but I don't know the truth. In what error?
index.html:
<html ng-app="TakingsApp">
<head>
<title>Ingresos cine español</title>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/bower_components/angular/angular.min.js"></script>
<script src="/bower_components/angular-route/angular-route.min.js"></script>
<script src="editTaking-ctrl.js"></script>
<script src="listTaking-ctrl.js"></script>
</head>
</head>
<body ng-view>
</body>
You have not imported the file
takins-app.js
, so the module is not declared . Make sure to add it before the other two files but after the AngularJS files: