user3418042
user3418042

Reputation: 179

AngularJS function in not called

This a simple angular controller but isn't working. I cant find any problems with the code. Can you ?

<!DOCTYPE html>
<html>
<head>
<title>AngularJS Controller</title>
</head>
<body>
    <div ng-controller="SimpleController">
        Name:
        <br/>
        <input type="text" ng-model="nameText"/>
        <br/>
        <ul>
        <li ng-repeat="cust in customers | filter:nameText | orderBy : 'name' ">{{ cust.name }} - {{ cust.city }}
        </li>
        </ul>
    </div>


<script src="Scripts/angular.min.js"></script>

<script>
    function SimpleController ($scope){
        $scope.customers = [ 
            { name:'Konstantinos Korovesis', city:'Pikermi' },
            { name:'Akis Manolis', city:'Argos' },
            { name:'Irem Var', city:'Nea Smirni' },
            { name:'Antonis Ralis', city:'Pallini' }
        ];
    }
</script>

</body>
</html>

.................................This is what i see in my browser...................

Name:

[................]

{{ cust.name }} - {{ cust.city }}

Upvotes: 0

Views: 64

Answers (1)

Chris Herring
Chris Herring

Reputation: 3665

Add ng-app. Angular needs it to specify the root of the document for angular.

<html ng-app>

Upvotes: 1

Related Questions