无法加载资源:服务器响应状态为404 angularjs

时间:2015-02-16 10:46:42

标签: angularjs

我是棱角分明的新人 其他绑定工作正常,但$ https调用不起作用 当我打电话给http call

时,我收到了这样的错误

无法加载资源:服务器响应状态为404(未找到) 我的脚本代码是

(function(angular) {
   var myApp = angular.module("myApp", []);
   myApp.controller('myTestController', function($scope, $http) {
     $scope.firstName = "Test";
     $http.get("Students/GetStudents").success(function(response) {
       $scope.firstName = response;
     });
   });
 })(window.angular); 

我的API控制器是:

[HttpGet]
public string GetStudents() {
    return "My Value";
}

1 个答案:

答案 0 :(得分:0)

在Api控制器中: [HttpGet] [Route("getStudents")] public string GetStudents() { return "My Value"; }

并且有角度: 为“学生/学生”改变“学生/学生”

相关问题