Dinesh Dinesh - 7 months ago 19
Javascript Question

Unexpected error in angular js

I am learning angularjs & facing error with angularjs
I am trying to create a simple angular module getting error
but sample controller function working ok without mudule
I write the same code of video where from I am learning

Here is code

<!DOCTYPE html>
<html ng-app="demoApp">
<head>
<title>
Angular js
</title>
</head>
<body>
<div class="containers" ng-controller="simpleController">
<input type="text" ng-model="name">
<ul>
<li ng-repeat="cust in customers | filter: name" | orderBy:'city'>{{ cust.name | uppercase}} - {{ cust.city | lowercase}}</li>
</ul>
</div>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript">
var demoApp = angular.module('demoApp'. []);
function simpleController ($scope) {
$scope.customers = [
{name:'Dinesh', city:'Delhi'},
{name:'Hansa', city:'Rajasthan'},
{name:'Manju', city:'Rajasthan'},
{name:'Mukesh', city:'Rajasthan'},
{name:'Naresh', city:'Lahor'}
];
}
demoApp.controller('simpleController', simpleController);
</script>
</body>
</body>
</html>


but my app not work properly, display error like below
enter image description here

Now my this question is solve
this code is working with AngularJS v1.2.28 but same code not work with AngularJS v1.5.5
Thanks for help in advance

Answer

Everything is ok
except angular.module('demoApp'. []),
must be angular.module('demoApp', []) - comma instead of dot, and be more attentive

<script type="text/javascript">
var demoApp = angular.module('demoApp'. []); //REPLACE DOT WITH COMMA
    function simpleController ($scope) {
        $scope.customers = [
        {name:'Dinesh', city:'Delhi'},
        {name:'Hansa', city:'Rajasthan'},
        {name:'Manju', city:'Rajasthan'},
        {name:'Mukesh', city:'Rajasthan'},
        {name:'Naresh', city:'Lahor'}
        ];
    }
    demoApp.controller('simpleController', simpleController);
</script>