从angularJs发布json时,参数始终为空值

时间:2018-09-03 16:07:47

标签: c# angularjs asp.net-mvc

RegisterRoutes

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
        name: "API",
        url: "api/{controller}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );

    routes.MapRoute(
         "Default",
        "{*catchall}", 
         new { controller = "Home", action = "Index" }
    );
    routes.AppendTrailingSlash = true;
}

函数angulajs

this.submitGestHonoFormH = function (std) {

    $http.post('/api/sasie/formulaire/', { student: std }, { headers: { 'Content-Type': 'application/json' } })

};
  • 调试时,永远不会将formDate学生分配给他。始终为NULL。有人遇到这个问题吗?

0 个答案:

没有答案