AngularJs如何将Json String传递给$ scope.msg = msg.data

时间:2016-10-12 09:34:27

标签: javascript angularjs json

public JsonResult Authe(string Email, string Password, bool ? Active) {
    var x = (from n in db.Authntications where n.Email == Email && n.Password == Password select n).FirstOrDefault();
    if (x != null) {
        var xx = (from n in db.Authntications where n.Email == Email && n.Password == Password && n.Active == Active select n).FirstOrDefault();
        if (xx == null) {
            msg = "Your A/c not activated....";
        }
    } else
        msg = "Your Account Details Not Valid  please check Details You mentiond...";
    return new JsonResult {
        JsonRequestBehavior = JsonRequestBehavior.AllowGet
    };
}

AngularJs

var ZmrSer = MyAuthneticService.Authen(Sucess);
$scope.msg = msg.data; 
$('#modalSuccess').modal('show');

1 个答案:

答案 0 :(得分:0)

您应该从允许获取行为的操作方法返回Json

return Json(msg, JsonRequestBehavior.AllowGet);