mardi 9 août 2016

Why is AngularJS code not working?

I have started learning MEAN Stack and wanted to try some code but AngularJs Controller is not working on my PC. I have windows 10 on my Acer Aspire V Nitro.

Can anyone please help. Will be highly obliged.

My code - AngularJS Test.html

<html ng-app="directoryApp">
    <head>
        <title>AngularJS Test</title>
        <script src="angular.min.js"></script> 
        <script src="directory.js"></script>
    </head>
    <body ng-controller="directoryController">
        <input type="text" ng-model="search" placeholder="Search">
        <ul>
            <li ng-repeat="item in list | filter: search">
                 - 
            </li>
        </ul>
    </body>
</html>

directory.js

angular.module('directoryApp', []).controller('directoryController', function($scope)) {
        $scope.list = [
            {name:'Scott', age: 29},
            {name:'Courtney', age: 29}, 
            {name:'Ross', age: 31}, 
            {name:'Ben', age: 32}
        ]

    });

it's just showing - below the search box as the output when I open it in any browser

I am a newbie to MEAN stack. Please help me out.

Thank you.

Aucun commentaire:

Enregistrer un commentaire