Reputation: 855
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
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
Upvotes: 0
Views: 353
Reputation: 3118
Change this
angular.module('demoApp'. []),
must be angular.module('demoApp', []) - comma instead of dot
Upvotes: 0
Reputation: 935
In addition to the previous answers, I don't see you referencing the ng-app directive in your HTML so that should be in your body tag like this: body ng-app="demoApp"
Upvotes: 1
Reputation: 341
var demoApp = angular.module('demoApp'. []);
It should be
var demoApp = angular.module('demoApp', []);
A comma instead of a period. Just a syntax error :)
Upvotes: 2
Reputation: 11930
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>
Upvotes: 1