Nakib Nakib - 1 year ago 152
AngularJS Question

Angularjs Uncaught Error: [$injector:modulerr]

I am learning Angular.js and I am not able to figure out whats wrong with this simple code. It seems to look fine but giving me following error.

**Error**: Uncaught Error: [$injector:modulerr]$injector/modulerr?p0=app&p1=Error%3A%20…

And before adding
(I was just keeping it as
) it was giving me following errors. Why is that?

Error: [ng:areq]
at Error (native)
at Sb (
at tb (
at $get (
at s (
at A (
at g (
at g (

<!doctype html>
<html ng-app="app">
<script src=""></script>

<div ng-controller="Ctrl">
<input ng-model="name">

var Ctrl = function($scope)
$scope.age = 24;


Answer Source

After AngularJS version 1.3 global controller function declaration is disabled

You need to first create an AngularJS module & then attach all the components to that specific module.


function Ctrl($scope) {
    $scope.age = 24;

angular.module('app', [])
    .controller('Ctrl', ['$scope', Ctrl]);

There is some issue with AngularJS 1.3.14 downgrade it to 1.3.13 works fine, I'd prefer you to use angular 1.2.27 AngularJS 1.5.X, Which is more stable version & latest release of AngularJS.

Working Plunkr


You could do your current code to working state by allow global controller declaration inside angular.config

function Ctrl($scope) {
    $scope.age = 24;

angular.module('app', [])
        function ($controllerProvider) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download