In general, the problem is as follows. There is an Index.cshtml view:

<!DOCTYPE html> <html ng-app ="testApp"> <head> <meta charset="utf-8"> <title>Users</title> <script src="~/Scripts/angular.min.js"></script> <script> var testApp = angular.module('testApp', []); testApp.controller('TestCtrl', function ($scope, $http) { $http({ method: 'GET', url: 'api/users'}).then(function success(response) { $scope.users = response.data; }); }); </script> </head> <body ng-controller="TestCtrl"> <div id="createBlock"> <table> <tr> <td>Name</td> </tr> <tr ng-repeat="user in users"> <td>{{user.Name}}</td> </tr> </table> </div> </body> </html> 

When you start the application, everything is fine:

enter image description here

But if you register a request to the controller itself, then the data is not displayed:

enter image description here

  • Now it’s too time to check, but there is a suspicion that in the second case this line is: $http({ method: 'GET', url: 'api/users'}) refers to the address /Home/Index/api/users . - Yaant
  • Yes, that is right. Thanks for the help. - Andriy Velgosh

0