In below code uncommented part is not working ("Third method").
All page doesn't work. Not a part of it..
But when I use the "Second method" it's working..
<html data-ng-app="demoApp">
<head>
<title>...</title>
</head>
<body>
<div class="container" data-ng-controller="SimpleController">
<h3>Using controller data</h3>
Name: <input type="text" data-ng-model="personTxt"/> {{personTxt}}
<ul>
<li data-ng-repeat="person in customers | filter:personTxt | orderBy:'city'">{{person.name}} . {{person.city}}</li>
</ul>
</div>
<script src="angular.min.js"> //Should be at the starting of the script</script>
<script>
var demoApp = angular.module('demoApp', []);
/* Third method */
var controllers = {};
controllers.SimpleController =
function ($scope) {
$scope.customers = [
{name:'Sahan Chamika Munasinghe', city:'Kaburupitiya'},
{name:'Nuwan Sachinthana', city:'Walgama'},
{name:'Diunuge Buddhika Wijesinghe', city:'Matara'}
];
$scope.personTxt = "My Name";
});
demoApp.controller(controllers);
</script>
</body>
</html>
Second type
/* Second method */
/*
demoApp.controller('SimpleController',
function ($scope) {
$scope.customers = [
{name:'Sahan Chamika Munasinghe', city:'Kaburupitiya'},
{name:'Nuwan Sachinthana', city:'Walgama'},
{name:'Diunuge Buddhika Wijesinghe', city:'Matara'}
];
$scope.personTxt = "My Name";
});
demoApp.controller('SimpleController', SimpleController);
*/