如何在asp.net mvc中使用带有数据注释的角度js验证字段?

时间:2022-09-12 09:17:58
public string Email { get; set; }
[RegularExpression(@"^((https?|ftp)://|(www|ftp)\.)[a-z0-9-]+(\.[a-z0-9-]+)    ([/?].*)?$", ErrorMessage = "Please enter valid web address.")]
public string Web { get; set; }

[Required(ErrorMessage = "Company Name is required.")]
public string CompanyName { get; set; }

This is my code first validation in mvc. I am using angular js please help me how to used angular js for validation.

这是我在mvc中的代码首次验证。我正在使用角度js请帮助我如何使用角度js进行验证。

1 个解决方案

#1


0  

use like following code in view

在视图中使用如下代码

<validated-input name="Web " display="Web " ng-model="model.Web" required>
<validated-input name="CompanyName" display="CompanyName" ng-model="model.CompanyName" required>

#1


0  

use like following code in view

在视图中使用如下代码

<validated-input name="Web " display="Web " ng-model="model.Web" required>
<validated-input name="CompanyName" display="CompanyName" ng-model="model.CompanyName" required>