Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用RESTfull和AngularJs进行客户端和服务器端验证_C#_Angularjs_Asp.net Mvc 4_Validation_Rest - Fatal编程技术网

C# 使用RESTfull和AngularJs进行客户端和服务器端验证

C# 使用RESTfull和AngularJs进行客户端和服务器端验证,c#,angularjs,asp.net-mvc-4,validation,rest,C#,Angularjs,Asp.net Mvc 4,Validation,Rest,在RESTfull服务(c#)和AngularJs之间实现验证的最佳方法是什么 我有一个RESTfull服务,它将返回AngularJs使用的ViewModel。我想实现类似C#MVC验证的功能,即在模型上定义服务器端验证,并在输入字段中添加angular [Required(ErrorMessage = "An Album Title is required")] [CustomValidation] [StringLength(160, MinimumLe

在RESTfull服务(c#)和AngularJs之间实现验证的最佳方法是什么

我有一个RESTfull服务,它将返回AngularJs使用的ViewModel。我想实现类似C#MVC验证的功能,即在模型上定义服务器端验证,并在输入字段中添加angular

      [Required(ErrorMessage = "An Album Title is required")]
      [CustomValidation]
      [StringLength(160, MinimumLength = 2)]
      public string Title { get; set; }

 <div class="editor-field">
      @Html.EditorFor(model => model.Title)
      @Html.ValidationMessageFor(model => model.Title)
 </div>
[必需(ErrorMessage=“需要专辑标题”)]
[客户验证]
[StringLength(160,最小长度=2)]
公共字符串标题{get;set;}
@EditorFor(model=>model.Title)
@Html.ValidationMessageFor(model=>model.Title)