I have used angular and angular routing
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
In error this file Indexcontroller.js
var app = angular.module('myapp', ['ngRoute']);
app.controller('myCtrl', ['$scope']);
app.config(["$routeProvider", function($routeProvider) {
$routeProvider
.when('/ui-login', {
templateUrl: 'ui-login.html',
controller: 'loginController'
})
.otherwise({
redirectTo: '/ui-login'
});
}]);
app.controller('loginController', function($scope) {
//Controller Here
$scope.submit = function() {
console.log("hi i m coming");
}
console.log("in controller");
});
Error:
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.9/$injector/modulerr?p0=myApp&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.9%2Fangular.min.js%3A22%3A332)
Output: enter image description here
ngRoute
to the controller as well. Possible link solution – ZombieChowderangular.js
andangular-route.js
files should have matching versions. Change1.2.0rc1
to1.6.9
– Aleksey SoloveymyApp
, whereas your module is namedmyapp
. You don't pass a controller function in here:app.controller('myCtrl', ['$scope']);
. And for better error logs you can change.min.js
to.js
– Aleksey Soloveyjs
includes is the source if your issue. Just double check everything and you should resolve this issue easily. – ZombieChowder