Tell me where I was wrong in this code? Why does ng-controller refuse to work? Thanks in advance.

var testapp = angular.module("testapp", []); testapp.controller('DemoCtrl', function($scope) { $scope.users = [{ 'name': 'Aleh', 'surname': 'Sokolovskuy' }, ]; }); 
 <html ng-app="testapp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script> </head> <body ng-controller="DemoCtrl"> <ul> <li ng-repeat="name in users"> <p>{{users.name}}</p> </li> </ul> </body> </html> 

    1 answer 1

    You use the wrong variable in the template: users instead of name :

     var testapp = angular.module("testapp", []); testapp.controller('DemoCtrl', function($scope) { $scope.users = [{ 'name': 'Aleh', 'surname': 'Sokolovskuy' }, ]; }); 
     <html ng-app="testapp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script> </head> <body ng-controller="DemoCtrl"> <ul> <li ng-repeat="name in users"> <p>{{name.name}}</p> </li> </ul> </body> </html> 

    • Thank you very much, showed inattention. - Isabella Monza